Logo

Javascript Questions Set 42:

Quiz Mode

How to add an element at the end of an array?

1
2
3
4

Solution:

"var" and "function" are :

1
2
3
4

Solution:

What are the two incompatible versions of YUI?

1
2
3
4

Solution:

How to create an element in the HTML DOM?

1
2
3
4

Solution:

How do you specifically execute a command in JavaScript?

1
2
3
4

Solution:

What is the output of the following code?

const notUs = ['ant', 'bison', 'camel', 'duck', 'bison'];

console.log(notUs.indexOf('bison'));

1
2
3
4

Solution:

What will be the output of the following JavaScript code?


function output(option) 

    return (option ?  “yes” :  “no”); 

    bool ans=true; 

console.log(output(ans)); 

1
2
3
4

Solution:

Predict the output:

function add(fn) {
return function(s) {
var result = s + ' is Best';
fn(result);
}
}

function print(s) {
document.write(s);
}

var g = add(print);
g('Abekus');

1
2
3
4

Solution:

What is the output of the following code?

const animals = ['pigs', 'goats', 'sheep'];

const count = animals.push('cows');

console.log(count)

1
2
3
4

Solution:

If the user presses “ok” in the dialog box then what will be the output of the following JavaScript code? 


 

function msg()
{  
   var v= confirm("Are u sure?");  
   if(v==true)
   {  
       alert("yes");  
   }  
   else
   {  
       alert("no");  
   }  
}

1
2
3
4

Solution: