Java Script Introduction Flashcards
The method used to log or print messages to
the console. It can also be used to print objects and other info.
console.log()
Example console.log(‘Hi there!’);
// Prints: Hi there!
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.
JavaScript
term used to return information about an object, and are called by
appending an instance with a period . , the ___? name,
and parentheses.
Methods
Example
// Returns a number between 0 and 1
Math.random();
Libraries
contain methods that can be called by appending the
library name with a period . , the method name, and a set of
parentheses.
Math.random();
// Math is the library
are a primitive data type. They include the set of all
integers and oating point numbers.
numbers let amount = 6; let price = 4.99;
The ____? property of a string returns the number of
characters that make up the string.
String .length Example let message = 'good nite'; console.log(message.length); // Prints: 9 console.log('howdy'.length); // Prints: 5
Term Data Instances ?
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.
a primitive data type. They can be either true or false . Are called?
Booleans
Example let lateToWork = true;
A function returns a floating-point, random
number in the range from 0 (inclusive) up to but not including
The Math.random() Example console.log(Math.random()); // Prints: 0 - 0.9
A function that returns the largest integer less than
or equal to the given number.
The Math.floor()
Example
console.log(Math.floor(5.95));
// Prints: 5
In JavaScript, single-line comments are created with ?
two consecutive forward slashes // .
Example
// This line will denote a comment
A primitive data type. It represents the intentional absence of value.
null
Example
let x = null;
A primitive data type. They are any grouping of primitive data type. They are any grouping of characters (letters, spaces, numbers, or symbols) surrounded by single quotes ‘ or double quotes “ . Is called a
Strings
Example
let single = ‘Wheres my bandit hat?’;
let double = “Wheres my bandit hat?”;
JavaScript supports arithmetic operators for:
Addition Subtraction Multiplication Division
// Addition 5 + 5 // Subtraction 10 - 5 // Multiplication 5 * 10 // Division 10 / 5
JavaScript supports arithmetic operator that returns
the remainder or signed remainder of a division,
Examples
// Modulo
10 % 5