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;
1 Crore+ students have signed up on EduRev. Have you? Download the App |
Arrays in JavaScript are defined by which of the following statements?
What will be the output of the following JavaScript code snippet?
// JavaScript Equalto Operators
function equalto()
{
int num=10;
if(num===”10”)
return true;
else
return false;
}
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;
What will be the output of the following JavaScript program?
function sanfoundry(javascript)
{
return (javascript ? “yes” : “no”);
}
bool ans=true;
console.log(sanfoundry(ans));
Which of the following can be used to call a JavaScript Code Snippet?
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 is a more efficient JavaScript code snippet?
Code 1 :
// for loop in javascript
for(var num=10;num>=1;num--)
{
document.writeln(num);
}
Code 2 :
var num=10;
while(num>=1)
{
document.writeln(num);
num++;
}
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?
var quiz=[1,2,3];
var js=[6,7,8];
var result=quiz.concat(js);
document.writeln(result);
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;
}
Which of the following methods/operation does javascript use instead of == and !=?