Notes Flashcards

1
Q

Why is it dangerous to use innerHTML in input elements?

A

It can allow the user to penetrate and control the js

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can you save a number of html elements into an array automatically with JavaScript

A
  1. In Html, give the elements the same class names
  2. In your JavaScript, select them using getElementByClassName
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What do you call an the element that receives an event to execute a function?

A

Event handler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What do you call the container of all the information of an event?

A

Event object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In events, the executed function is called_____________?

A

Event handler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In Events context, the executed functions’s parameter is called ___________?

A

Event object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What’s the big four of JavaScript

A

Variable
Function
Array
Loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is event bubbling

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you stop eventBubbling

A

Use stopPropogation method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you link an external js file with HTML file?

A

Hhhhhh

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What’s a class in Javascript

A

It’s like a template that defines what properties (characteristics) and methods (actions) objects created from it will have.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What’s the syntax for declaring a class?

A

class className {

   constructor(){

 this.property = value

}

functionName (){

}

}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is an instance in js?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The five basic features of a JavaScript Class?

A
  1. CONSTRUCTOR: used to initialize properties for the children objects.
  2. METHOD: A function that the objects can call.
  3. INHERITANCE: Sub classes created in your class.
  4. SETTER & GETTER: You can retrieve (get) and modify(set) the value of a class
  5. STATIC METHOD:
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Why do we use the new keyword before our classname()

A

It’s going to call the constructor, access every properties to them, make a new object out of it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly