DEV Community

Margaret W.N
Margaret W.N

Posted on

1 1

Eloquent Javascript

More on the book. What i learnt today:

Closure:

being able to reference a specific instance of a local binding in an enclosing scope. A function that references bindings from local scopes around it is called a closure.

A pure function

a specific kind of value-producing function that not only has no side effects but also doesn’t rely on side effects from other code—for example, it doesn’t read global bindings whose value might change. A pure function has the pleasant property that, when called with the same arguments, it always produces the same value

Array Methods

includes() - checks if a given value exists in the array.
shift() - removes the first(zero index) item from an array.
unshift() - adds a item at the front(zero index) of an array
indexOf() - searches through the array from the start to the end and returns the index at which the requested value was found
lastIndexOf() - searches through the array from the end(last item)
trim () - removes whitespace (spaces, newlines, tabs, and similar characters) from the start and end of a string
... Spread Syntax - expands or spreads out an array, passing its elements as separate arguments.

Looping through arrays using let item of items.

for (let item of items) { 
console.log(item); 
}
Enter fullscreen mode Exit fullscreen mode

Math Object functions

Math.floor() - rounds down
Math.ceil() - rounds up
Math.round() - rounds to the nearest whole number
Math.abs() - takes the absolute value of a number, Negates a negative.

What is JSON?

A serialization format. Serialization means converting to a a flat description.
Json Methods
JSON. parse() Converts a JSON string to a JavaScript object
JSON. stringify() Converts a JavaScript object to a JSON string

That's it for Day 80
I'll continue with the book tommorrow

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay