0
Javascript doubt in challenge questions.
3 odpowiedzi
+ 3
gokul b
Or operator returns only first true value
true || false = true
false || true = true
In this example a is undefined and b is null and both a and b are not value.
c and d has value and both are true so first true value will be return
So 4 || 'five' = 4
if you write d || c then 'five' will be return.
+ 3
gokul b
let is blocked scope variable means if you define let in if condition then you cannot access outside if block
if (true) {
let a = 'abc';
}
console.log(a) //error
if (true) {
var a = 'abc';
}
console.log(a) //print abc
https://www.sololearn.com/post/1280529/?ref=app
+ 1
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ thanks.
And please define let.