Q#1. What is JavaScript?
Ans. JavaScript is a client-side as well as server side scripting language that can be inserted into HTML pages and is understood by web browsers. JavaScript is also an Object based Programming language
Q#2. Is JavaScript a case-sensitive language?
Ans. Yes, JavaScript is a case sensitive language. The language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.
Q#3. In JavaScript what is an argument object?
Ans. The variables of JavaScript represent the arguments that are passed to a function.
Q#4. Enumerate the differences between Java and JavaScript?
Ans. Java is a complete programming language. In contrast, JavaScript is a coded program that can be introduced to HTML pages. These two languages are not at all inter-dependent and are designed for the different intent. Java is an object - oriented programming (OOPS) or structured programming language like C++ or C whereas JavaScript is a client-side scripting language.
Q#5. What is a name function in JavaScript & how to define it?
Ans. A named function declares a name as soon as it is defined. It can be defined using function keyword as
function named(){
// write code here
}
Q#6. What is the difference between JavaScript and JScript?
Ans. Netscape provided the JavaScript language. Microsoft changed the name and called it JScript to avoid the trademark issue. In other words, you can say JScript is the same as JavaScript, but Microsoft provides it.
Q#7. Between JavaScript and an ASP script, which is faster?
Ans. JavaScript is faster. JavaScript is a client-side language and thus it does not need the assistance of the web server to execute. On the other hand, ASP is a server-side language and hence is always slower than JavaScript. Javascript now is also a server side language (nodejs).
Q#8. What is the difference between undeclared & undefined?
Ans. Undeclared variables are those that do not exist in a program and are not declared. If the program tries to read the value of an undeclared variable, then a runtime error is encountered. Undefined variables are those that are declared in the program but have not been given any value. If the program tries to read the value of an undefined variable, an undefined value is returned.
Q#9. What is the difference between == and ===?
Ans. The == operator checks equality only whereas === checks equality, and data type, i.e., a value must be of the same type.
Q#10. What is 'this' keyword in JavaScript?
Ans. 'This' keyword refers to the object from where it was called.