#244 Javascript Interview Questions by Frontend Master || #frontendmaster #javascript #frontend

preview_player
Показать описание
3 Ways to convert String to Numbers
.
+, Number and parseInt. these three Number() and Unary Plus(+) works exactly same.

Below are the major differences between Number constructor function and parseInt.
1. Number(x) does type coercion to number, while parseInt(x) does parsing.

2.Number works well with Scientific Numbers
Number("83e4"); // 830000
Number("2e2"); // 200

parseInt('4e3'); // 4

3. Empty, Nullish value handling is different.
Number(""); // 0
Number(false); // 0
Number(null); // 0
Number([]); // 0

Number(true); // 1

parseInt(""); // NaN
parseInt(null); // NaN
parseInt(false); // NaN
parseInt([]); // NaN

parseInt(true); // NaN

parseInt(undefined); // NaN
parseInt({}); // NaN

Number({}); // NaN

4. Number() can’t differentiate different Number System, but parseInt can with radix argument.
parseInt(10,8)// Octal conversion - output 8
parseInt(101,2)// Binary conversion - output 5

Similarity:
They both also ignore whitespace:
const foo = " 6 ";

Javascript Interview Questions

Рекомендации по теме
Комментарии
Автор

Damn
never knew about this. This channel is underrated

Sneakingmentor
Автор

Thanks bro
Yours YouTube shorts preparing me for my next interview
👍👍👍

mohitpardhi
Автор

everything comes under global and block so 2.

shahidullahmuffakir
Автор

Bro teaching only to people who knows hindi👍🙏

gowtham
Автор

Finally all comes under Only two scopes global and block scope

aravind_gowda
Автор

Where is Lexical scope which is created for closure and nested functions

shivendradwivedi
Автор

Explain the difference between global scope and script scope

navneetarora
Автор

Local, global, function and block scope

Movie_ki_kahani
Автор

What's the difference between script scope and module scope?

satya_is_one
Автор

4 hote hain sir according to mdn website
Block, function, global and module.

abhiiop
Автор

officially 4 scope are there, that script scope hasn't yet consider as scope! Am I correct sir?

techstudy
Автор

Starting ke shir 3 hi samajh me aaya, do practical

Md.Fuzail
Автор

what is the difference between module scope and script scope?

khatri_-x
Автор

Just reversing the order of explanation would have worked way better

gopallohar
Автор

Ye sab interviews me pucha jata hai kya ?

vishnuraghav
Автор

ap jo bhi interview question puchte ho plz unka ans thoda ache se bataye, bahut jaldi jaldi kar ke bata dete ho.

jagdishjena
Автор

What is most important in interview projects, theory or coding ??

Sanatani_gamerz
Автор

Isiliye Javascript maine nhin sikha lots of js lore 😂. I use typescript to safe. I love statistically typed language more

xbinarylol
welcome to shbcf.ru