JS Flashcards
what are the two steps for creating a variable?
variable declaration and variable assignement
how do you turn a string to a number?
use the Number method Number()
how do you turn a number to a string?
use the string method String()
what data type does the prompt command return?
the prompt() command always returns a string value
what is the DOM?
The DOM stands for “Document Object Model” and is a tree-like structure that is a representation of the HTML document, the relationship between elements, and contains the content and properties of the elements.
what is a program?
a list of commands telling a computer what to do. These orders are written as text files and make up what’s called the “source code” of the program. The lines of text in a source code file are called lines of code.
what is a variable?
it is an information storage area
how do you iterate over an array
usign a for loop , a foreach or a for-of
how do you obtain an arrays size
using the .length method
how do i add an element to the end of an array?
array.push(element)
how do i add an element to the beginning of an array?
array.unshift(element)
how do you remove an element from the end of an array?
array.pop()
how to concatenate array elements into a string?
use array.join(“”) method the symbol used in the parameter surrounds the string, if any space is added in the middle itll separate the elements with said space