Notes Flashcards
Why is it dangerous to use innerHTML in input elements?
It can allow the user to penetrate and control the js
How can you save a number of html elements into an array automatically with JavaScript
- In Html, give the elements the same class names
- In your JavaScript, select them using getElementByClassName
What do you call an the element that receives an event to execute a function?
Event handler
What do you call the container of all the information of an event?
Event object
In events, the executed function is called_____________?
Event handler
In Events context, the executed functions’s parameter is called ___________?
Event object
What’s the big four of JavaScript
Variable
Function
Array
Loop
What is event bubbling
It happens when an element receives an event, and that event bubbles up (or you can say is transmitted or propagated) to its parent and ancestor elements in the DOM tree until it gets to the root element.
How do you stop eventBubbling
Use stopPropogation method
How do you link an external js file with HTML file?
Hhhhhh
What’s a class in Javascript
It’s like a template that defines what properties (characteristics) and methods (actions) objects created from it will have.
What’s the syntax for declaring a class?
class className {
constructor(){ this.property = value
}
functionName (){
}
}
What is an instance in js?
It is a specific and unique individual object that is created from a class. It has it’s own property and can use the method in the class
The five basic features of a JavaScript Class?
- CONSTRUCTOR: used to initialize properties for the children objects.
- METHOD: A function that the objects can call.
- INHERITANCE: Sub classes created in your class.
- SETTER & GETTER: You can retrieve (get) and modify(set) the value of a class
- STATIC METHOD:
Why do we use the new keyword before our classname()
It’s going to call the constructor, access every properties to them, make a new object out of it