Javascript Syntax: Intro Flashcards

1
Q

console.log()

A

The console.log() method is used to log or print messages to the console. It can also be used to print objects and other info.

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

JavaScript

A

JavaScript is a programming language that powers the dynamic behavior on most websites. Alongside HTML and CSS, it is a core technology that makes the web run.

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

Methods

A

Methods return information about an object, and are called by appending an instance with a period ., the method name, and parentheses.

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

Libraries

A

Libraries contain methods that can be called by appending the library name with a period ., the method name, and a set of parentheses.

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

Numbers

A

Numbers are a primitive data type. They include the set of all integers and floating point numbers.

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

String .length

A

The .length property of a string returns the number of characters that make up the string.

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

Data Instances

A

When a new piece of data is introduced into a JavaScript program, the program keeps track of it in an instance of that data type. An instance is an individual case of a data type.

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

Booleans

A

Booleans are a primitive data type. They can be either true or false.

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

Math.random()

A

The Math.random() function returns a floating-point, random number in the range from 0 (inclusive) up to but not including 1.

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

Math.floor()

A

The Math.floor() function returns the largest integer less than or equal to the given number.

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

Single Line Comments

A

In JavaScript, single-line comments are created with two consecutive forward slashes //.

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

Null

A

Null is a primitive data type. It represents the intentional absence of value. In code, it is represented as null.

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

Strings

A

Strings are a primitive data type. They are any grouping of characters (letters, spaces, numbers, or symbols) surrounded by single quotes ‘ or double quotes “.

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

Arithmetic Operators

A

JavaScript supports arithmetic operators for:

\+ addition
- subtraction
* multiplication
/ division
% modulo
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Multi-line Comments

A

In JavaScript, multi-line comments are created by surrounding the lines with /* at the beginning and */ at the end. Comments are good ways for a variety of reasons like explaining a code block or indicating some hints, etc.

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

Remainder / Modulo Operator

A

The remainder operator, sometimes called modulo, returns the number that remains after the right-hand number divides into the left-hand number as many times as it evenly can.

17
Q

Assignment Operators

A

An assignment operator assigns a value to its left operand based on the value of its right operand. Here are some of them:

\+= addition assignment
-= subtraction assignment
*= multiplication assignment
/= division assignment
18
Q

String Interpolation

A

String interpolation is the process of evaluating string literals containing one or more placeholders (expressions, variables, etc).

It can be performed using template literals: text ${expression} text.

19
Q

Variables

A

Variables are used whenever there’s a need to store a piece of data. A variable contains data that can be used in the program elsewhere. Using variables also ensures code re-usability since it can be used to replace the same value in multiple places.

20
Q

Undefined

A

undefined is a primitive JavaScript value that represents lack of defined value. Variables that are declared but not initialized to a value will have the value undefined.

21
Q

Learn Javascript: Variables

A

A variable is a container for data that is stored in computer memory. It is referenced by a descriptive name that a programmer can call to assign a specific value and retrieve it.

22
Q

Declaring Variables

A

To declare a variable in JavaScript, any of these three keywords can be used along with a variable name:

var is used in pre-ES6 versions of JavaScript.
let is the preferred way to declare a variable when it can be reassigned.
const is the preferred way to declare a variable with a constant value.

23
Q

Template Literals

A

Template literals are strings that allow embedded expressions, ${expression}. While regular strings use single ‘ or double “ quotes, template literals use backticks instead.

24
Q

let Keyword

A

let creates a local variable in JavaScript & can be re-assigned. Initialization during the declaration of a let variable is optional. A let variable will contain undefined if nothing is assigned to it.

25
Q

const Keyword

A

A constant variable can be declared using the keyword const. It must have an assignment. Any attempt of re-assigning a const variable will result in JavaScript runtime error.

26
Q

String Concatenation

A

In JavaScript, multiple strings can be concatenated together using the + operator. In the example, multiple strings and variables containing string values have been concatenated. After execution of the code block, the displayText variable will contain the concatenated string.