Hi!, this is my first post and I wanted to make it a little and simple javascript quiz but I wont give you the answers, the idea is that you put your answers in the comments and discussed which ones are correct and which are not, so let's begin!
1.- What is the result of this expression? (or multiple ones)
["1", "2", "3"].map(parseInt)
a) ["1","2", "3"]
b) [1,2,3]
c) [1, NaN, NaN]
d) other (give your answer)
2.- What is the result of this expression? (or multiple ones)
[typeof null, null instanceof Object]
a) ["object", true]
b) ["object", false]
c) ["object", null]
d) other (give your answer)
3.- What is the result of this expression? (or multiple ones)
var x = [].reverse;
x();
a) window
b) other
c) undefined
d) true
4.- What is the result of this expression? (or multiple ones)
2 == [[[2]]]
a) false
b) true
c) error
d) undefined
5.- What is the result of this expression? (or multiple ones)
var a = /123/,
b = /123/;
a == b
a === b
a) true, true
b) true, false
c) false, true
d) other
6.- What is the result of this expression? (or multiple ones)
var a = {}, b = Object.prototype;
[a.prototype === b, Object.getPrototypeOf(a) === b]
a) [true, false]
b) [true, true]
c) [false, false]
d) none of the above
Top comments (8)
I think 4 out of 6 is a good score!
Bonus task:
Make a function that satisfies these conditions!
hello, thanks for the question, could you explain why the 5 is false, false ? please
because you're comparing references, not their values.
SO Thread: stackoverflow.com/questions/110327...
because they are regex which means object. cheers
Why error with these expressions?
Q1 : B
I think Q2 : A
I'm new to this website, and not able to select options or locate ans.
Would somebody help me to find answers?
You can't select the options, my idea was that you paste your answers here in the comment section and discuss them with the community haha