JS Flashcards

1
Q

What is JS?

A

Dynamic programming language that’s used for web development, web applications, game development, and lots more.

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

What does JS allow you to do?

A

To implement dynamic features on web pages that cannot be done with only HTML and CSS.

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

What are some examples of JS?

A

Click to see dropdown menu, extra content added to a page, and dynamically changing element colors on a page, …. you’re seeing the effects of JavaScript.

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

In the index.html file we enter:


what does this do?

A

It’s doing the same job as the <link></link> element for CSS

It applies the JavaScript to the page, so it can have an effect on the HTML, CSS and anything else on the page.

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

Explain: The function called querySelector()

A

The querySelector() method returns the first element that matches a CSS selector.

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

What are variables?

A

Variables are containers that store values.

You start by declaring a variable with the “let” keyword, followed by the name you give to the variable:

EG: let myVariable;

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

After declaring a variable, you can give it a value: for example :

myVariable = “Bob”;

How can we retrieve the value ?

A

by calling the variable name:

myVariable;

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

Variables may hold values that have different DATA TYPES…can you name some?

A

string : eg - let myVariable = “Bob”

number : eg - let myVariable = 10;

Boolean: ( true / false) : eg let myVariable = true;

array ( store multiple values in a single reference.) : eg - et myVariable = [1,’Bob’,’Steve’,10];

object ( Everything in JavaScript is an object and can be stored in a variable) EG: let myVariable = document.querySelector(‘h1’);

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

Give an example of a comment?

A

snippets of text that can be added along with code. The browser ignores text marked as comments.

/*
Everything in between is a comment.
*/

OR

//This is a comment

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

Give an example of an Operator?

A

mathematical symbol that produces a result based on two values (or variables).

EG: Assignment - the = symbol ;
let myVariable = ‘Bob’;

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

Give an example of a conditional ?

A

code structures used to test if an expression returns true or not.

EG: A very common form of conditionals is the if…else statement.

let iceCream = “chocolate”;
if (iceCream === “chocolate”) {
alert(“Yay, I love chocolate ice cream!”);
} else {
alert(“Awwww, but chocolate is my favorite…”);
}

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

Give an example of a function?

A

way of packaging functionality that you wish to reuse.

EG: alert(“hello!”);

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

Give an example of an event?

A

Real interactivity on a website requires event handlers

These are code structures that listen for activity in the browser, and run code in response. The most obvious example is handling the click event, which is fired by the browser when you click on something with your mouse.

document.querySelector(“html”).addEventListener(“click”, function () {
alert(“Ouch! Stop poking me!”);
});

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

Now lets watch this video!

A

https://www.youtube.com/watch?v=1HUS1OvpX80

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

How can we build our skills in web development ?

A

Watch google videos, eg : net ninja, stop and start and follow along by doing the coding on VS code with the video

Use Chat GPT: ask questions about how to change , adapt and build code

Use co-pilot in VS code: see what co-pilot delivers and then try to undertsnad d why that code was useful

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