Logo

Javascript Questions Set 45:

Quiz Mode

Which property is used to access the first child of a node? 

1
2
3
4

Solution:

 When the “end” event fires on EOF when no more data will arrive, which function is called? 

1
2
3
4

Solution:

What will be the output of the following code?

<p id="abekus"></p>


<script>
var x = "";
document.getElementById("abekus").innerHTML = Boolean(x);
</script>

1
2
3
4

Solution:

What is the purpose of the timing property in the window.performance object?

1
2
3
4

Solution:

What is the purpose of the textContent property?

1
2
3
4

Solution:

When is a web application said to have good web performance?

1
2
3
4

Solution:

What will be the output of the following JavaScript code?


var obj = {

length: 20,

height: 35

}

if ('breadth' in obj === false)

{

obj.breadth = 12;

}

console.log(obj.breadth);

1
2
3
4

Solution:

  What can be done in order to avoid the creation of global variables in JavaScript? 

1
2
3
4

Solution:

What will be the output of the following JavaScript code?

<button onclick="myFunction()">Try it</button>
<p id="demo">one</p>
<script>
function myFunction()
{
  var str = document.getElementById("demo").innerHTML;
  var txt = str.replace("one","two");
  document.getElementById("demo").innerHTML = txt;
}
</script>

1
2
3
4

Solution:

What does the following code do?


var a = document.getElementById("demo");

var arr = a.childNodes;

for (var x = 0; x < arr.length; x++)

{

arr[x].innerHTML = "new text";

}

1
2
3
4

Solution: