True Basics Flashcards

1
Q

How do you do one line comments in javascript ?

A
// enter comment here
// enter comment2 here
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you do multi-line comments in javascript?

A
/* comment
blah blah blah
*/ this line ends the comment
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you assign a value to a string variable?

A

var name = “george” ;

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

What does initializing a variable mean

A

assigning an initial value to a variable.

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

What date type does a variable value have if you do not assign a value?

A

undefined

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

Are variables case sensitive in javascript?

A

yes

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

Write three words together as one word to show you understand what camel case is.

A

helloMyFriend

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

What data type is the value 5 in javascript?

A

number

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

_____is a data type in javascript which represents numeric data

A

number

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

How do you add two numeric values in Javascript

A

5 + 5

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

How do you subtract two numeric values in javascript

A

7 - 3

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

How do you multiply two numeric values in javascript

A

7 * 3

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

How do you divide two numeric values in javascript

A

9 / 3

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

How do you increment the number of a variable in javascript (suppose i is the variable)

A

i++

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

How do you decrement the number of a variable in javascript (suppose i is the variable)

A

i–

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

What data type stores decimal numbers?

A

floating point

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

What is the operator for remainder

A

%

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

What what does the remainder operator return

A

The remainder that’s left over after division

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

Rewrite myVar = myVar + 5 into a compound assignment

A

myVar += 5

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

Rewrite myVar = myVar - 5 into a compound assignment

A

myVar -= 5

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

Rewrite myVar = myVar * 5 into a compound assignment

A

myVar *= 5

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

What does escaping a quote mean?

A

When you use the backslash from within quotations to include the same quotation character as a part of it.

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

How do you escape the “ character

A

"

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

How do you escape the ‘ character

A

'

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

how do you escape a backslash

A

\

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

how do you escape a new line?

A

\n

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

how do you escape a carriage return?

A

\r

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

how do you escape a tab?

A

\t

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

how do you escape a word boundary?

A

\b

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

how do you escape a form feed?

A

\f

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

How do you concatenate two string fields together?

A

“string content 1” + “string content 2”

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

How do you concatenate two strings together (through a variable) using the same sequence that represents incrementing a number?

A
var ourStr = "I come first. ";
ourStr += "I come second.";
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

How do you find the length of the value of a variable

Assume variable is called variableName

A

variableName.length

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

How do you find the first character of a string variable

Assume variable is called variableName

A

variableName[0]

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

How do you find the second character of a string variable

Assume variable is called variableName

A

variableName[1]

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

How do you find the third character of a string variable

Assume variable is called variableName

A

variableName[2]

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

How do you find the last character in a string variable?

Assume variable is called variableName

A

variableName[variableName.length -1]

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

How do you find the second last character in a string variable?

Assume variable is called variableName

A

variableName[variableName.length -2]

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

_______ are the classifications we give to the different kinds of data that we use in programming.

A

data types

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

In JavaScript, there are _____ fundamental data types:

A

seven

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

What is the data type for Any number, including numbers with decimals: 4, 8, 1516, 23.42

A

number

42
Q

What is the data type for any grouping of characters on your keyboard (letters, numbers, spaces, symbols, etc.) surrounded by single quotes: ‘ … ‘ or double quotes “ … “. Though we prefer single quotes.

A

string

43
Q

This data type only has two possible values— either true or false (without quotes).

A

boolean

44
Q

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

A

null

45
Q

This data type is denoted by the keyword ____(without quotes). It also represents the absence of a value though it has a different use than null.

A

undefined

46
Q

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

A

symbols

47
Q

What are objects?

A

Object: Collections of related data.

48
Q

Operators aren’t just for numbers! When a + operator is used on two strings, it _____ the right string to the left string

A

appends

49
Q

This process of appending one string to another is called

A

concatenation

50
Q

Every string has a property called _____ that stores the number of characters in that string.

A

length

51
Q

What are methods?

A

Actions we can perform in javascript.

52
Q

To use a method on a string how do we call the method?

A

by appending an instance with a period (the dot operator), the name of the method, and opening and closing parentheses: e.g. ‘example string’.methodName().

53
Q

When we use console.log() we’re calling the ___method on the ____ object

A

log method

console object

54
Q

When we use console.log() we’re calling the log method on the ____ object

A

console

55
Q

When we use console.log() we’re calling the ____method on the console object

A

log

56
Q

write a console.log statement that would convert what would be the output “dead tree” to upper case.

A

console.log(‘dead tree’.toUpperCase());

57
Q

write a console.log statement that would remove the whitespace in string ‘ Remove whitespace ‘

A

console.log(‘ Remove whitespace ‘.trim());

58
Q

Write a console.log statement that would return a random floating point number between 0 and 100.

A

console.log(Math.random() * 100);

59
Q

What method takes a decimal number, and rounds down to the nearest whole number.

A

Math.floor()

60
Q

How would you ensure a whole number output that generates a random number between 0 and 100 using a console.log statement

A

console.log(Math.floor(Math.random() * 100));

61
Q

Find a method on the JavaScript Math object that returns the smallest integer greater than or equal to a decimal number.

Use this method with the number 43.8. Log the answer to the console.

A

console.log(Math.ceil(43.8)) ;

62
Q

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

A

console.log()

63
Q

______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.

A

Javascript

64
Q

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

A

html

65
Q

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

A

css

66
Q

_____return information about an object, and are called by appending an instance with a period ., the ____ name, and parentheses.

A

methods

67
Q

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

A

libraries

68
Q

Numbers

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

A

number

69
Q

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

A

.length

70
Q

When a new piece of data is introduced into a JavaScript program, the program keeps track of it in _______ of that data type.

A

an instance

71
Q

An instance is an individual case of a _____

A

data type

72
Q

An ____ is an individual case of a data type.

A

instance

73
Q

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

A

booleans

74
Q

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

A

Math.random()

75
Q

The _____ function returns the largest integer less than or equal to the given number.

A

Math.floor()

76
Q

In JavaScript, single-line comments are created with

A

two consecutive forward slashes //.

77
Q

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

A

null

78
Q

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

A

strings

79
Q

Arithmetic Operators - what is the operator for addition

A

+

80
Q

Arithmetic Operators - what is the operator for subtraction

A

-

81
Q

Arithmetic Operators - what is the operator for multiplication

A

*

82
Q

Arithmetic Operators - what is the operator for division

A

/

83
Q

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.

A
/* at beginning
*/ at end
84
Q

An assignment operator assigns a value to its left operand based on the value of its right operand.

Write number = number + 10 in a way that demonstrates the additional assignment

A

number += 10

85
Q

An assignment operator assigns a value to its left operand based on the value of its right operand.

Write number = number - 7 in a way that demonstrates the subtraction assignment

A

number -= 7

86
Q

An assignment operator assigns a value to its left operand based on the value of its right operand.

Write number = number * 3 in a way that demonstrates the multiplication assignment

A

number *= 3

87
Q

An assignment operator assigns a value to its left operand based on the value of its right operand.

Write number = number / 10 in a way that demonstrates the division assignment

A

number /= 10

88
Q

_____ 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.

A

undefined

89
Q

What is the way to declare a variable in pre-ES6 versions of javascript

A

var = value

90
Q

What is the preferred way to declare a variable in javascript post-ES6 if the value can be reassigned later

A

let = value

91
Q

What is the preferred way to declare a variable in javascript post-ES6 if the value should remain constant

A

const = value

92
Q

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

Embed the variable name into a console.log expression saying hello to the users

A

console.log (Hello, ${name})

93
Q

____ hold reusable data in a program and associate it with a name.

A

variables

94
Q

Variables are stored in ___

A

memory

95
Q

The var keyword is used in ____ versions of JS.

A

pre-ES6

96
Q

____is the preferred way to declare a variable when it can be reassigned

A

let

97
Q

____is the preferred way to declare a variable with a constant value

A

const

98
Q

Variables that have not been initialized store the primitive data type _____

A

undefined

99
Q

The __operator is used to concatenate strings including string values held in variables

A

+

100
Q

The + operator is used to _____ strings including string values held in variables

A

concatenate

101
Q

In ES6, template literals use backticks ` and ____to interpolate values into a string.

A

${}

102
Q

In ES6, ______ use backticks ` and ____to interpolate values into a string.

A

template literals