Javascript interview questions and answers for freshers and experienced

                                 What is JavaScript?

JavaScript is a loosely-type client side scripting language that execute in the user's browser.JavaScript interact with html elements in order to make interactive web user interface.JavaScript can be used in various activities like data validation,display popup message.

Javascript interview questions and answers
Javascript interview questions and answers
                                   


Q.1 Can you access Cookie using javascript?
 Yes

Q.2 Can you assign a anonymous function to a variable?
 Yes,But Anonymous JavaScript function assigned to a variable can be called at a later time.

Q.3 Define unescape() and escape() functions?
 See this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/unescape

Q.4 Is a javascript script faster than an ASP script?
 Yes, javascript is faster than ASP script.Because javascript is develop for client side whereas ASP  Script is server side.

Q.5 Can you pass a anonymous function as an argument to another function?
 See this:https://www.dashingd3js.com/lessons/javascript-callback-functions

                                     Javascript tricky interview questions

Q.6 Does JavaScript support automatic type conversion?
 Yes! Javascript support automatic type conversion.

Q.7 Explain the difference between “==” and “===”?
 See this:https://www.c-sharpcorner.com/blogs/difference-between-and-with-example-in-javascript2

Q.8 How to read and write a file using javascript?
 By using java script functions – fopen(),fread() and fwrite().

Q.9 How to delete a Cookie using JavaScript?
 See this: https://stackoverflow.com/questions/10593013/delete-cookie-by-name

Q.10 How to print a web page using javascript?
 window.print();

                                       Javascript tricky interview questions

Q.11 How to read elements of an array in JavaScript?
 var fruit = ["Mango", "Apple", "Banana"];
 var arry_name=["Item1","Item2","Item3"]

Q.12 How to redirect a url using JavaScript?
 window.location = "http://www.abc.com";

Q.13 What are JavaScript Data Types?
 See this: https://www.w3schools.com/js/js_datatypes.asp

Q.14 What is the use of blur function?
  If we use the blur method for the active element, then it loses the active state.

Q.15 What is the purpose of ‘this’ operator in JavaScript?
 When a function is called as a property on a parent object, this refers to the parent object inside that function.

                                         Javascript tricky interview questions

Q.16 Explain what is pop()method in JavaScript?
 See this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop

Q.17 How generic objects can be created?
 See this: https://blog.learntoprogram.tv/javascript-generic-object/

Q.18 What are Screen objects?
 See this: https://www.javatpoint.com/javascript-screen

Q.19 What are the different types of errors in JavaScript?
 See this: https://www.tutorialspoint.com/javascript/javascript_error_handling.htm

Q.20 What are the advantages of using JavaScript?

1.Easy to learn.
2.It execute on client's browser,so eliminate server side processing.
3.It execute on any OS.
4.JavaScript can be used with any type of web page e.g. PHP,ASP.NET,Perl etc.
5.Performance of web page increases due to client side execution.

Post a Comment

Post a Comment (0)

Previous Post Next Post