Cristian Salcescu's Blog, page 7

June 30, 2021

How to Pass Arguments to setTimeout and setInterval Callbacks

Use the additional arguments when calling the timer functions

Continue reading on Frontend Essentials »

 •  0 comments  •  flag
Share on Twitter
Published on June 30, 2021 23:02

June 29, 2021

3 Ways to Conditionally Invoke a Callback

The if statement, the And operator, and the optional chaining operator

Continue reading on Frontend Essentials »

 •  0 comments  •  flag
Share on Twitter
Published on June 29, 2021 23:02

June 28, 2021

June 24, 2021

How to Conditionally Invoke a Method

The And operator, the optional chaining method calls operator, and more

Continue reading on Frontend Essentials »

 •  0 comments  •  flag
Share on Twitter
Published on June 24, 2021 23:03

June 23, 2021

How to Find Elements in Large Arrays

Quick start with filter and find. Improve search speed by creating and using maps.

Continue reading on Frontend Essentials »

 •  0 comments  •  flag
Share on Twitter
Published on June 23, 2021 23:07

June 21, 2021

How to Store and Retrieve Objects From the Local and Session Storage

JSON.stringify, JSON.parse utilities, setItem and getItem store methods and more

Continue reading on Frontend Essentials »

 •  0 comments  •  flag
Share on Twitter
Published on June 21, 2021 23:02

Interesting Things to Know About The toString and valueOf Methods

Quick start with converting objects into primitives in JavaScript

Continue reading on Frontend Essentials »

 •  0 comments  •  flag
Share on Twitter
Published on June 21, 2021 03:03

All Objects are Truthy Values

All Objects are Truthy Values

Converting any object into a boolean gives the true value. Here are a few examples.

Boolean({}) //true
Boolean([]) //true
Boolean(new Date()) //true

Even the wrapper object for the false value returns true.

const falseWrapper = new Boolean(false);
Boolean(falseWrapper); //true

All objects are considered to be truthy values. They are evaluated to true in a test condition.

if({}){
console.log('Truthy');
}else {
console.log('Falsy');
}
//'Truthy'

Negating an object using the Not (!...

 •  0 comments  •  flag
Share on Twitter
Published on June 21, 2021 01:02

June 16, 2021

How To Convert Between Primitives in JavaScript

Get up to speed with the Number, String, and Boolean functions

Continue reading on Better Programming »

 •  0 comments  •  flag
Share on Twitter
Published on June 16, 2021 08:48