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
12. Syntax for creating a RegExp object: var txt=new RegExp(pattern,attributes); var txt=/pattern/attributes; Which of the above mentioned syntax will correct?
- (a) only
- (b) only
- Both (a) and (b)
- None of the above
13. <script language="javascript"> function x(z,t) { alert(x.length); } </script> output: ?
- Error
- 2
- 1
- 3
14. What is mean by "this" keyword in javascript?
- It refers current object
- It referes previous object
- It is variable which contains value
- None of the above
15. In JavaScript, Window.prompt() method return true or false value ?
- False
- True
- None of above
17. <script language="javascript"> function x() { var s = "Quality 100%!{[!!"; var pattern = /\w/g; var output = s.match(pattern); document.write(output); } </script>
- %,!,{,[,!,!
- Q,u,a,l,i,t,y,1,0,0
- Quality 100
- Error
18. <script type="text/javascript" language="javascript"> var qpt= new Array(); qpt[0] = "WebDevelopment"; qpt[1]="ApplicationDevelopment" qpt[2]="Testing" qpt[3] = "QualityPointTechnologies"; document.write(qpt[0,1,2,3]); </script>
- Error
- QualityPointTechnologies
- WebDevelopment
- WebDevelopmnet,ApplicationDevelopment,Testing,QualityPointTechnologies