JavaScript Flashcards
(213 cards)
what does the console keyword refer to?
an object, collection of data and actions that can be used in our code
how do you print in javascript?
console.log( ) ;
how do you write a single line comment in JavaScript?
with two forward dashes //
How do you write a multi-line comment in JavaScript?
/ *
- /
What are data types?
classifications given to different kinds of data used in programming
What are the 8 fundamental data types in JavaScript?
number (any number, including decimals)
string (any grouping of characters surrounded by single quotes) (string can be thought of as a fancy word for text)
boolean: data type with only two values - true or false
null: intentional absence of a value
undefined: also represents absence of a value, with different uses to null
symbol: unique identifiers
object: collections of related data
BigInt: represents integers of arbitrary length
What are the data types number, string, boolean, null, undefined, and symbol referred to as?
primitive data types - the most basic data types in the JavaScript language
What is the difference between using console.log() to print numbers and text
text needs quotation marks around it within the brackets of console.log() whereas numbers do not
What is an operator in JavaScript?
a character that performs a task in the code
Give some arithmetic operators
\+ add - subtract * multiply / divide % remainder
What is the remainder operator sometimes called?
modulo (although it’s not quite a modulo)
What does the remainder operator do?
prints the remainder (returns the number that remains after the right hand number divides into the left hand number
What is the process of appending one string to another called?
concatenation
What property stores the number of characters in a string?
length
What are methods?
actions we can perform
What does math.floor() do?
takes a decimal and rounds it to the nearest whole number
what does math.random() do?
generates a random number between 0 to 1
What is a variable?
a container for a value that is stored in the computer’s memory
named storage for data
What can you do with variables?
create a variable with a descriptive name
store or update information stored in a variable
reference or ‘get’ information stored in a variable
what keywords can you use to declare variables?
let and const
What is the conventional way of capitalising in JavaScript called?
Camel Casing
How does camel casing work?
all words are grouped into one long word, the first word is not capitalised, then every word that follows is capitalised
myName
camelCaseEverything
what is the operator ‘ = ‘ called?
the assignment operator
what does the assignment operator do?
it assigns a value to a variable