Javascript Questions and Answers
JavaScript questions with answers help web development students and IT professionals strengthen their coding fundamentals. Commonly asked in placement exams and interviews by companies like TCS, Infosys, and Wipro, these programming questions cover syntax, DOM manipulation, event handling, and ES6 features. Practicing JavaScript programming questions and answers enhances logical thinking and coding accuracy. These exercises are perfect for anyone aiming to master web technology and ace technical interviews with confidence.
Javascript
Showing 10 of
78 questions
21. <script language="javascript"> function x() { document.write(2+5+"8"); } </script>
- 258
- Error
- 7
- 78
23. In Javascript, Which of the following method is used to evaluate the regular expression?
- eval(2*(3+5))
- evaluate(2*(3+5))
- evalu(2*(3+5))
- None of the above
24. <script language="javascript"> function x() { var s= "quality 100%"; var pattern = /\d/g; var output= s.match(pattern); document.write(output); } </script>
- 100
- 1,0,0
- q,u,a,l,i,t,y,%
- Error
25. <script type="text/javascript" language="javascript"> qpt=((45%2)==0)? "hello" : "bye"; document.write(qpt); </script>
- hello
- bye
- Error in string handling
- None of the above
26. <script language="javascript"> function x() { var qpt = "QualityPointTechnologies"; var pattern = new RegExp("POIiNT","i"); document.write(qpt.match(pattern)); } </script>
- Error
- POIiNT
- Point
- null
27. How do you create a new object in JavaScript?
- var obj = {};
- var obj = Object();
- var obj=new {};
- None of the above
28. In Javascript, What does isNaN function do ?
- Return true if the argument is not a number.
- Return false if the argument is not a number.
- Return true if the argument is a number.
- None of the above
29. If x=103 & y=9 then x%=y , what is the value of x after executing x%=y?
- 4
- 3
- 2
- 5