Q. What will be the output of the following code snippet?
Code:<script type="text/javascript" language="javascript"> var a = "Scaler"; var result = a.substring(2, 4); document.write(result); </script>
Dear candidates you will find MCQ questions of JavaScript here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question
<script type="text/javascript" language="javascript"> var a = "Scaler"; var result = a.substring(2, 4); document.write(result); </script>
<script type="text/javascript" language="javascript">
var x=12;
var y=8;
var res=eval("x+y");
document.write(res);
</script>
The <noscript> tag is used in HTML to provide alternative content for users who either have JavaScript disabled in their browser or are using browsers that do not support JavaScript. It does not clear cookies or cache.
(function(){
setTimeout(()=> console.log(1),2000);
console.log(2);
setTimeout(()=> console.log(3),0);
console.log(4);
})();
(function(a){
return (function(){
console.log(a);
a = 6;
})()
})(21);
function solve(arr, rotations){
if(rotations == 0) return arr;
for(let i = 0; i < rotations; i++){
let element = arr.pop();
arr.unshift(element);
}
return arr;
}
// solve([44, 1, 22, 111], 5);
<p id="example"></p>
<script>
function Func()
{
document.getElementById("example").innerHTML=Math.sqrt(81);
}
</script>
var a = 1;
var b = 0;
while (a <= 3)
{
a++;
b += a * 2;
print(b);
}