Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions 100Questions/100_JS_Que
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ console.log(name()); //Error: name is not a function
//Explaination : Function we are calling but it's not present so it will an error.
--------------------------------------------
const result = false || {} || 20 || null;
console.log(result); //20
console.log(result); //{}
//Explaination : OR operator will find first positive value. Null is a falsy value by default. {} is a positive value. It didn't reach till 20 and null.
--------------------------------------------
const result = null || false || '';
Expand Down Expand Up @@ -181,7 +181,7 @@ function sumValues(x,y,z){
return x+y+z;
}
sumValues(...[2,3,4]) //how to call a function so that output will be 9
//Explaination : we can't do like this sumValues(2,3,4).
//Explaination : we can't do like this sumValues(2,3,4). // we can also call through spread operator
----------------------------------------------------
const name = "priya is a girl.";
console.log(typeof name); //string
Expand Down Expand Up @@ -474,7 +474,7 @@ function sayHi(){
return ()=>0;
}
console.log(typeof sayHi()); //function
console.log(typeof sayHi()()); //function
console.log(typeof sayHi()()); //number
//Explaination : sayHi will return anonymous arrow function/IIFE, where we didn't invole the arroe function so it will return function.
-----------------------------------------------------------------------------
console.log(typeof typeof 1); //string
Expand Down