JavaScript
Created January 6, 2026 5:37 PM
Tags js
Date Created January 7, 2026
Last Studied
March 6, 2026
Date
Status In progress
-2 1 10 11 12 13 2 3 4 5 6
lectures
7 8 9
Introductionary JavaScript
Console
the console keyword refers to an object, a collection of data
and actions, that we can use in our code.
JavaScript 1
, Keywords are words that are built into the JavaScript
language, so the computer recognizes them and treats them
specially.
One action, or method, built into the console object is
the .log() method.
When we write console.log() , what we put inside the parentheses
will get printed, or logged, to the console.
Comments
There are two types of code comments in JavaScript:
1. A single-line comment will comment out a single line and
is denoted with two forward slashes // preceding it.
// Prints 5 to the console
console.log(5);
2. A multi-line comment will comment out multiple lines and
is denoted with /* to begin the comment, and */ to end
the comment.
/*
This is all commented
console.log(10);
None of this is going to run!
console.log(99);
*/
Data Types
Data types: are the classifications we give to the different
kinds of data that we use in programming.
In JavaScript, there are eight fundamental data types:
1. Number: Any number, including numbers with decimals
JavaScript 2
, 2. BigInt: Any number, greater than 253
-1 or less than -(253
-1), with n appended to the number: 1234567890123456n
3. String: Any grouping of characters on the keyboard
(letters, numbers, spaces, symbols, etc.) surrounded by
single quotes or double quotes (singlr is prefered)
4. Boolean: This data type only has two possible values —
either true or false (without quotes)
5. Null: represents the intentional absence of a value, and is
represented by the keyword null (without quotes)
6. Undefined: undefined means that a given value does not
exist.
This data type is denoted by the
keyword undefined (without quotes). It also represents
the absence of a value, though it has a different use
than null .
7. Symbol: A newer feature of the language, symbols are unique
identifiers that are useful in more complex coding.
8. Object: Collections of related data.
9. Array:
First 7 are Primitive data types, while 8th & 9th are non-
orimitive
Arithmetic Operators
JavaScript has several built-in arithmetic operators, that
allow us to perform mathematical calculations on numbers.
These include the following operators and their corresponding
symbols:
1. Add: +
2. Subtract: -
JavaScript 3
, 3. Multiply: *
4. Divide: /
5. Remainder: %
String Concatenation
concatenation: When a + operator is used on two strings, it
appends the right string to the left string:
The computer will join the strings exactly, so we must include
the space we want between the two strings.
console.log('hi' +'ya');// Prints 'hiya'
console.log('wo' +'ah');// Prints 'woah'
console.log('I love to ' +'code.')
// Prints 'I love to code.'
Properties
introduce a new piece of data into a JavaScript program, the
browser saves it as an instance of the data type.
All data types have access to specific properties that are
passed down to each instance
For example, every string instance has a property called
length that stores the number of characters in that string.
We can retrieve property information by appending the
string with a period and the property name:
console.log('Hello'.length); // Prints 5
*The . is another operator! We call it the dot operator.
JavaScript 4