Week 2: JavaScript and jQuery Flashcards

1
Q

JavaScript

A

JavaScript is a programming language used to make web pages interactive. Like HTML and CSS, you do not need to install anything to begin writing JavaScript or see it run on your users’ computers. All modern browsers support JavaScript which means JavaScript that you write for your web pages will automatically run when your visitors load your web page in their browsers. In fact, JavaScript is the only scripting language that all browsers support so if you want a page to have dynamic content, learning JavaScript is a must.

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

jQuery

A

jQuery is a JavaScript library that makes it easier to incorporate JavaScript on your web pages. When we say it is a library, we mean that many common tasks that would take many, many lines of JavaScript code to execute have been packaged into methods that you’ll be able to use with a single line of code.

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

The only 3 things a web browser can do:

A
  1. Display content with HTML
  2. Style it with CSS
  3. Change what’s displayed with JavaScript
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Modulo

A

% operator that will give you the remainder of dividing two numbers.

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

Operators

A

An operator is a special character (or characters) that indicates an action to be performed.
Examples: +, -, *, /, %

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

NaN

A

Stands for not a number, and is a result of dividing 0 by 0.

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

Infinity

A

Dividing anything by 0. Also considered a number.

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

Tips for naming JavaScript variables:

A
  • Variables should begin with a letter.
  • Variables are case sensitive (myNumber is a different variable than myNUMBER).
  • Use clear names that describe the value being stored like myNumber.
  • Always name your variables in a manner that will be easy for other developers to understand. Avoid vague letters or initials. (For example: var x = 45 doesn’t tell us what the value is. Is 45 an age, a distance, size, a time?…)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Variable

A

Variables can be thought of as containers used to store information. They allow for a way to label data with a descriptive name.

A variable is just standing in for the number it represents.

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

Lower camel case

A

Use lowerCamelCase when naming JavaScript variables. Start with a lowercase letter, and if the variable name is more than one word, remove all spaces and capitalize the first letter of each subsequent word.

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

String

A

a JavaScript data type that represents the exact text of whatever is enclosed in the quotes

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

Method

A

A method is an action run on a piece of data; you can think of it as a message you send to a piece of data, and the result is the response.

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

Return value

A

The return value is the method’s response.

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

Argument

A

Some methods take one or more arguments that provide the method with additional information to help it perform its action.

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

Chaining methods

A

Calling a method directly on the return value of another method.

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

Concatenation

A

Combining two Strings together into one String

17
Q

Boolean

A

True and false are booleans. They are not strings - they simply represent being true or false.

18
Q

Assignment operator

A

Changes the value of the variable on the left of the operator.

= assign variable on left of operator value on right of operator

+= increase value of variable on left of operator by value on right of operator

  • = decrease value of variable on left of operator by value on right of operator
  • = multiply value of variable on left of operator by value on right of operator

/= divide value of variable on left of operator by value on right of operator

19
Q

Comparison operator

A

Does not change any values, but returns a boolean (true or false) depending on whether the statement evaluates as true or false.

=== is equal to

!== is not equal to

> greater than

> = greater than or equal to

< less than

<= less than or equal to

20
Q

String

A

Content inside of quotes. Such as “This is a string!”.

21
Q

To convert a string to a number:

A

var myNumber = parseInt(“42”)
> myNumber;
42

22
Q

To convert a number to a string:

A

> var convertedNumber = 42.toString();
convertedNumber;
“42”

23
Q

Function

A

A function is a block of code that performs an action and returns a result; optionally takes arguments.

Ex: alert() opens a dialog box and returns undefined

24
Q

Comment

A

Anything following // on a line in JavaScript is ignored by the computer. Comments are a convenient way to leave notes in your code for yourself or other programmers.