Java Script Introduction Flashcards
(22 cards)
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
In JavaScript, multi-line comments are created by surrounding
the lines with __? at the beginning and __? at the end.
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.
Example
/
The below configuration must be
changed before deployment.
*/
let baseUrl = ‘localhost/taxwebapp/country’;
_______? returns the number that remains after the right-hand number divides into the left-hand number as many times as it evenly can.
Remainder / Modulo Operator
The remainder operator, sometimes called modulo, returns the number that remains after the right-hand number divides into the left-hand number as many times as it evenly can.
Example
// calculates the number of days left over after 365 is divided by 7
const daysLeftOver = 365 % 7 ;
console.log(“A year has “ + daysLeftOver + “ days”);
There are 7 fundamental data types in JavaScript
strings, numbers, booleans, null, undefined, symbol, and object.
____?, including instances of data types, can have properties, stored information. The properties are denoted with a . after the name of the object, for example: ‘Hello’.length.
Objects, including instances of data types, can have properties, stored information. The properties are denoted with a . after the name of the object, for example: ‘Hello’.length.
Objects including instances of data types, can have ____? which perform actions. ____? are called by appending the object or instance with a period, the _____? name, and ____. For example: ‘hello’.toUpperCase().
Objects including instances of data types, can have methods which perform actions. Methods are called by appending the object or instance with a period, the method name, and parentheses. For example: ‘hello’.toUpperCase().
We can access ___? and _____? by using the ., dot operator.
We can access properties and methods by using the ., dot operator.
____?, including Math, are collections of methods and properties that JavaScript provides.
Built-in objects, including Math, are collections of methods and properties that JavaScript provides.