What is JavaScript?
Javascript MCQ Practice
Which of the following is correct about JavaScript?
Among the given statements, which statement defines closures in JavaScript?
What will be the output of the following JavaScript code snippet? <p id="demo"></p> var txt1 = "Sanfoundry_"; var txt2 = "Javascriptmcq"; document.getElementById("demo").innerHTML = txt1 + txt2;
What will be the output of the following JavaScript code? <p id="demo"></p> <script> var js = 10; js *= 5; document.getElementById("demo").innerHTML = js; </script>
Arrays in JavaScript are defined by which of the following statements?
What will be the output of the following JavaScript code? // JavaScript Comparison Operators function compare() { let a=2; let b=2.0; if(a==b) return true; else return false; }
What will be the output of the following JavaScript code snippet? advertisement // JavaScript Equalto Operators function equalto() { let num=10; if(num==="10") return true; else return false; }
Will the following JavaScript code work? var js = (function(x) {return x*x;}(10));
Which of the following is not javascript data types?
Where is Client-side JavaScript code is embedded within HTML documents?
What will be the output of the following JavaScript code snippet? int a=1; if(a!=null) // JavaScript not equal to Operators return 1; else return 0;
Which of the following object is the main entry point to all client-side JavaScript features and APIs?
What will be the output of the following JavaScript program? function sanfoundry(javascript) { return (javascript ? “yes” : “no”); } bool ans=true; console.log(sanfoundry(ans));
What will be the output of the following JavaScript code? // Javascript code snippet to compare the height function height() { var height = 123.56; var type = (height>=190) ? "tall" : "short"; return type; }
Which of the following can be used to call a JavaScript Code Snippet?
What will be the output of the following JavaScript function? <p id="demo"></p> <script> function javascript() { // javacript abs() method document.getElementById("demo").innerHTML = Math.abs(-7.25); } </script>
What will be the output of the following JavaScript code? var a=5 , b=1 var obj = { a : 10 } // with keyword in JavaScript with(obj) { alert(b) }
Which of the following explains correctly what happens when a JavaScript program is developed on a Unix Machine?
Which is a more efficient JavaScript code snippet?
What will be the output of the following JavaScript code? function printArray(a) { var len = a.length, i = 0; if (len == 0) console.log("Empty Array"); else { // do-while loop in javascript do { console.log(a[i]); } while (++i < len); } }
What happens in the following JavaScript code snippet? var js = 0; while (js < 10) { console.log(js); js++; }
What will be the output of the following JavaScript code? function range(int javascript) { int a=5; for(int i=0;i<javascript;i++) { console.log(a); } } range(3);
Which of the following scoping type does JavaScript use?
What is the basic difference between JavaScript and Java?
What will be the output of the following JavaScript code? var quiz=[1,2,3]; var js=[6,7,8]; var result=quiz.concat(js); document.writeln(result);
Why JavaScript Engine is needed?
What will be the function of the following JavaScript program? var scope = "js scope"; function checkscope() { var scope = "javascript scope"; function f() { return scope; } return f; }
What will be the output of the following JavaScript code? int a=0; for(a;a<5;a++); console.log(a);
Which of the following methods/operation does javascript use instead of == and !=?