Basic JavaScript Interview question and answers
Q 1 . What is JavaScript? A 1 . JavaScript is a scripting language used to create and control dynamic website content, such as forms, animations, and interactive elements. Q 2 . What are the data types in JavaScript? A 2 . The data types in JavaScript include: strings, numbers, booleans, objects, arrays, and functions. Q 3 . How do you define a variable in JavaScript? A 3 . Variables can be defined in JavaScript using the “var” keyword followed by the variable name. Q 4 . What is the purpose of the “this” keyword in JavaScript? A 4 . The “this” keyword is used to refer to the object that the current code is being executed in. Q 5 . What is the difference between == and === in JavaScript? A 5 . The “==” operator checks if two values are equal in value, while the “===” operator checks if two values are equal in value and type. Q 6 . What is the purpose of the “undefined” keyword in JavaScript? A 6 . The “undefined” keyword is used to denote a variable that ha...