Interview Questions Flashcards
What is the DOM?
DOM stands for Document Object Model. It is a representation of the HTML document displayed in a window. Objects are organized in a hierarchy.
What is ECMAScript and how does it relate to JavaScript?
ECMA is a standardized specification for scripting languages; JavaScript is a scripting language based on ECMA specification.
What is JavaScript?
JavaScript is a programming/scripting language that allows you to implement complex logic on web pages;
JavaScript is lightweight and interpreted programming language. It is most commonly utilized by client-side technologies.
What are some advantages that can be gained through using JavaScript
Less server interaction - Allows for client-side validation of user-input, reducing the number of unsuccessful HTTP requests.
Increased Interactivity - The Document Object Model can be manipulated based on different events initiated by the user
What does it mean that JavaScript is loosely typed?
This means that JavaScript does not require you to specify a type when declaring a variable.
What does it mean that JavaScript is an interpreted language?
This means that JavaScript is not pre-compiled. It is read line by line by the browser.
What tag would you use to wrap around a block of JavaScript on an HTML document and where would you need to place it?
Use the tag to wrap the JavaScript statement, and make sure the block is nested within the body of the HTML document.
Is JavaScript case sensitive?
Yes
How do you insert a comment in JavaScript?
// - Single-Line comment /* * Multi-line comment */
Does Javascript have data types? If it does, what are they?
Yes, and they are Boolean, Null, Undefined, Number, String, Object, Symbol, and Function
What are three different ways you can create variables in Javascript and when would you use each?
var - scope of the variable is its current execution context
let - scope of the variable is limited to the block in which it is created
const - scope of const is similar to let statement, but once assigned a value, it cannot be changed
What are global variables? How are these variables declared and what are the problems associated with using them?
Global variables are those that are available throughout the length of the code.
Global variables are created when the variables are declared outside of any block
Global variables make it hard to debug and test code
What Javascript values are considered falsey? What are considered truthy?
Falsey Values:
- undefined
- null
- NaN
- false
- ” “(empty string)
- 0
everything else is truthy
What are undeclared and undefined variables?
Undeclared variables are those that do not exist in a program, and if called gives a “reference not found” error
Undefined variables are those that are declared but have not been initialized with a value, and if called gives a “undefined” error
What is === operator vs == operator?
== double equals will perform a type conversion; === triple equals will not perform a type conversion, and will return false if the types are different