Single Choice Easy

QWhat will be the output of following JS program?

function getcube()
{  
    var number=document.getElementById("number").value;  
    alert(number*number*number);  
}
<form>  
     Enter No:<input type="text" id="number" value="3" name="number"/><br/>  
     <input type="button"  value="ok" onclick="getcube()"/>  
</form>

ID: #5082 Javascript DOM & Event Handling MCQ 165 views
Question Info
#5082Q ID
EasyDifficulty
Javascript DOM & Event Handling MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • B 27
  • C 9
  • D undefined
Correct Answer

Explanation

The value of the input text is obtained using the document.getElementById() method. But the input field's id must be defined.

Share This Question

Challenge a friend or share with your study group.