Introduction Flashcards

1
Q

What does console.log() ?

A

Data is printed, or logged, to the console, a panel that displays messages

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

How do you comment one line?

A

We can write single-line comments with//

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

How do you comment more than one line?

A

We can write multi-line comments between/*and/

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

What are the 7 fundamental data types in JavaScript ?

A

Strings, numbers, booleans, null, undefined, symbol, and object.

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

What is a string ?

A

Strings are characters wrapped in single or double quotes:’Sample String’

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

What are the built-in arithmetic operators ?

A

The built-in arithmetic operators include+,,,/, and%

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

What are the two things that objects can have ?

A

Properties & Method

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

What is a method?

A

Methodsare actions we can perform. Data types have access to specific methods that allow us to handle instances of that data type.

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

How do you call(or use) a method?

A

With :
- a period (the dot operator)
- the name of the method
- opening and closing parentheses

E.g.'example string'.methodName().

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

How is denoted a property on an object ?

A

The properties are denoted with a.after the name of the object, for example:’Hello’.length.

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

What is the data type object ?

A

Collections of related data.

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

What is the data type symbol ?

A

A newer feature to the language, symbols are unique identifiers, useful in more complex coding. No need to worry about these for now.

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

What is the data type undefined?

A

This data type is denoted by the keywordundefined(without quotes). It also represents the absence of a value though it has a different use thannull.undefinedmeans that a given value does not exist.

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

What is the data type Null?

A

Null: This data type represents the intentional absence of a value, and is represented by the keywordnull(without quotes).

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

What is the data type Boolean?

A

Boolean: This data type only has two possible values— eithertrueorfalse(without quotes). It’s helpful to think of booleans as on and off switches or as the answers to a “yes” or “no” question.

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

What is the data type string ?

A

Any grouping of characters on your keyboard (letters, numbers, spaces, symbols, etc.) surrounded by single quotes:’ … ‘or double quotes” … “, though we prefer single quotes. Some people like to think of string as a fancy word for text.

17
Q

What is the data type number ?

A

Any number, including numbers with decimals:4,8,1516,23.42.

18
Q

What is the definition of Data types?

A

Data typesare the classifications we give to the different kinds of data that we use in programming. In JavaScript, there are seven fundamental data types

19
Q

What are the 6 of data type consideredlike primitive data types?

A

Strings, numbers, booleans, null, undefined and symbol

20
Q

Which data type is not considered like a primitive date type?

A

Objectsare more complex, and you’ll learn much more about them as you progress through JavaScript. At first, seven types may not seem like that many, but soon you’ll observe the world opens with possibilities once you start leveraging each one. As you learn more about objects, you’ll be able to create complex collections of data.

21
Q

What “.toUpperCase()”method is going to do to a string?

A

This method returns a string in all capital letters

22
Q

What “.startsWith()” method is going to do to a string ?

A

This method also accepts the character’H’as an input, orargument, between the parentheses. Since the string’Hey’does start with the letter’H’, the method returns the booleantrue.

23
Q

What are Built-in objects ?

A

Built-in objects, includingMath, are collections of methods and properties that JavaScript provides.

24
Q

What does Math.floor (built-in object) do?

A

Math.floor()rounds the number down to the nearest whole number.

25
Q

What does Math.random (built-in object) do?

A

Math.random()generates a random number between 0 and 1.

26
Q

What is it going to print ?
console.log(Math.floor(Math.random() *50));

A

Prints arandom whole number between 0and 50
1. Math.random()generates a random number between 0 and 1.
2. We then multiply that number by50, so now we have a number between 0 and 50.
3. Then,Math.floor()rounds the number down to the nearest whole number.

27
Q

Properties

A

When you introduce a new piece of data into a JavaScript program, the browser saves it as an instance of the data type. All data types have access to specific properties that are passed down to each instance. For example, every string instance has a property calledlengththat stores the number of characters in that string.