Lesson 1 of 0
In Progress
Class-6
Class 6 – Introduction to JavaScript
Slides: Class6
Math Class Functions
- Math.round(): Rounds a number to the nearest integer.
- Math.ceil(): Rounds a number up to the nearest integer.
- Math.floor(): Rounds a number down to the nearest integer.
- Math.random(): Returns a random number between 0 (inclusive) and 1 (exclusive).
Controlling the Length of Decimals
- toFixed(): Limits the number of decimal places in a number to a specified length.
Arrays
- Definition and Use: Arrays store multiple values in a single variable, useful for collections of data.
- Creating Arrays: Arrays can be created using array literals or the
newkeyword. - Accessing Elements: Array elements are accessed using their index numbers.
- Updating Elements: Elements can be added or updated using their index.
Array Properties and Methods
- Length Property: Returns the number of elements in an array.
- Push Function: Adds elements to the end of an array.
- Pop Function: Removes the last element from an array.
- Shift Function: Removes the first element from an array.
- Unshift Function: Adds elements to the beginning of an array.
Array Data Structures
- Stack (LIFO): Last In, First Out data structure.
- Queue (FIFO): First In, First Out data structure.
Modifying Arrays
- Splice Function: Adds or removes elements from an array at a specific index.
- Slice Function: Creates a new array from a subset of an existing array.
This lecture will provide a comprehensive understanding of JavaScript’s Math class functions and array operations, essential for efficient data manipulation and mathematical computations in your programs.
