JavaScript Developer Questionnaire
1. What will be the value of b
?
var r = undefined ;
a = b = c = 20 ;
n = i = r ;
2. Describe each part of a for
loop structure.
3. Examine this for
loop.
for ( i = 0 ; i < n ; i ++ ) {
b = i ;
}
3.1 Explain at least 3 things wrong with it.
3.2 What will be the value of b
?
4. After the following code has run what will be the value of x
?
var x = true && true && true && false ;
5. After running the code below:
var x = 0 ;
function multiply ( a , b ) {
var x = a * b ;
return x ;
}
var z = multiply ( 20 , 10 ) ;
5.1 What will be the value of x
?
5.2 What will be the value of z
?
6. After running the code below:
( function ( ) {
b = 20 ;
var a = 10 * b ;
return a ;
} ) ( ) ;
6.1 what will be the value of b
?
6.2 What will be the value of a
?
7. What will be the value of a
?
8. What will be the value of a['foo']
?
var a = { bar : 10 , baz : 20 , foo : 40 } ;
a . foo += a . bar ;
9. What will be the value of a[3]
?
var a = "I ran all the way home" ;
10. What will be the value of b[3]
?
var b = "I ran all the way home" . split ( ' ' ) ;
11. What will be the value of m
?
var m = / test/ . test ( "I know this is a test" ) ;
12. After running the code below:
Object . prototype . mush = function ( ) {
var b = 0 , c = [ ] ;
if ( this instanceof Array ) {
b = this . reduce ( function ( s , i ) { return s + i ; } ) ;
c = this . map ( function ( i ) { return b ; } ) ;
}
return c ;
}
a = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 ] ;
a . mush ( ) ;
b = a [ 2 ] ;
12.1 What will be the value of b
?
12.2 What will be the value of a.mush()[2]
?
12.3 What will be the value of b == a.mush()[2]
How about a question on 'this'?
What does obj.sayName() return?