JavaScript Interview Questions and Answers

Q1. What is JavaScript?

Ans. JavaScript is a client-side scripting programming language which we can use for developing an application and plugin and also we can for develop a website with html. JavaScript more powerful programming language you can the live example of JavaScript such as- AngularJs, jQuery etc. All browsers supported to JavaScript and easily use with html and execute on browser no need to any extra things for JavaScript developers.

Q2. What are JavaScript Data types?

Ans. Number, String, Boolean, Function, Object, Undefined

Q3. What is the use of isNaN function?

Ans. The isNaN function is use for checking a number type data and this will return TRUE or False.

Q4. Which company developed JavaScript?

Ans. JavaScript developed by NETSCAPE company.

Q5. How we can see console.log() function value?

Ans. If you are console.log() function and print the any statement you can see the output of this function on your same executed browser by inspect element after that click console.

Q6. JavaScript indexOf() and Array indexOf() Method?

Ans. Use of these function you can get the position of string or array such as-

Syntax: array.indexOf(item, start)

var arr= [“A”, “B”, “C”, “D”];
arr.indexOf(“C”);

Output will be 2

var arr= [“A”, “B”, “C”, “D”, “E”, “F”, “C”, “G”];
arr.indexOf(“C”, 4);

Output will be 6

var arr= [“A”, “B”, “C”, “D”, “E”, “F”, “C”, “G”];
arr.indexOf(“C”, 1);

Output will be 2

Here, I’m going describe for string Same function.

var str= ‘I l.ove my india’;
str.indexOf(“m”);

Output will be 7

Note: The indexOf method was introduced in JavaScript 1.6, and does not work in Internet Explorer 8 and earlier versions.

News Reporter
IT Software and web development, Core PHP, JavaScript, JQuery, HTML, CSS, CakePHP, Angularjs, Codeigniter etc.

Leave a Reply

Your email address will not be published. Required fields are marked *

error: