DEV Community

Cover image for Javascript Journey
Sandeep Balachandran
Sandeep Balachandran

Posted on

1

Javascript Journey

Hey there,

Alt text of image

I have been thinking about organising things i learned and still learning at a single place like this.

So instead of going to google and then stack overflow i can directly come right here.

Wow . Brilliant idea . Nobody would have never thought about this. Classic.

I know you may think like that. But wait. There is more. I bet you can find atleast one new thing from here.

Lets start with some very basic one.

What is a closure?

So baby pull me closure in the back seat of your ... nop not that.

A closure is basically an inner function that has access to the outer or enclosing function's variables.

details

So the canIGoToMars returns the inner function firstThingFirst.
canIGoToMars function has a variable in its local scope called greeting.
firstThingFirst function has access to the greeting variable . It console logs the greeting variable plus the name variable we pass into the canIGoToMars function.

An example of closure.

HTML

details

CSS

details

Javascript

details

References

MDN Web Docs
Dude Explaining Closure

Lets wrap up with a real complex javascript scenario only god can answer.

How to console a certain word without using its entire letters

Say here its 'banana'. We can use most likely

console.log(('b' + 'a' + + 'a' + 'a').toLowerCase());

Developers are still researching on this.

If we can go through their updates it would be

+'a' resolves to NaN ("Not a Number") because it coerces a string to a number, while the character a cannot be parsed as a number.

Thats it for now.

Image of Timescale

šŸš€ pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applicationsā€”without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post ā†’

Top comments (0)

The best way to debug slow web pages cover image

The best way to debug slow web pages

Tools like Page Speed Insights and Google Lighthouse are great for providing advice for front end performance issues. But what these tools canā€™t do, is evaluate performance across your entire stack of distributed services and applications.

Watch video