Skip to content

In this repository is designed to help learn and master JavaScript along with concepts, preparing them for backend developer. You can read the about JavaScript from the below websites👇👇👇👇

License

Notifications You must be signed in to change notification settings

abhishek6619/JavaScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction to JavaScript🚀

Welcome to the JavaScript repo! Here, I have my JavaScript explorations - code and notes.

📚 Learning Resources

I’m currently following the Chai Aur Code YouTube channel for JavaScript tutorials and insights by Hitesh Sir. Feel free to check it out for additional perspectives and insights!

You Can read the basic of javascript from here Mdn

JavaScript is a versatile, lightweight scripting language widely used in web development. It can be utilized for both client-side and server-side development, making it essential for modern web applications. Known as the scripting language for web pages, JavaScript supports variables, data types, operators, conditional statements, loops, functions, arrays, and objects. With JavaScript, you can create dynamic, interactive, and engaging websites.

1. Variables in JavaScript


JavaScript Variables are the building blocks of any programming language. In JavaScript, variables can be used to store reusable values.

List of variables:

Variables name Description
Var Oldest keywords to declare a variable and var can be updated and redeclared.
let Block-scoped, can’t be accessible out the particular block, and let can be updated but not redeclared.
Const Block scope, neither be updated nor redeclared.
var geek = "Hello World"     // Declaration using var
let $ = "Welcome"           // Declaration using let
const _example = "Hello"      // Declaration using const

2. Data types in JavaScript

Data type in JavaScript defines the type of data stored in a variable.

List of data types

Name Description
Numbers Represent both integer and floating-point numbers.
String A string is a sequence of characters. In JavaScript, strings can be enclosed within single or double quotes.
Boolean Represent a logical entity and can have two values: true or false.
Null This type has only one value: null. It is left intentionally so that it shows something that does not exist.
Undefined A variable that has not been assigned a value is undefined.
Symbol Unlike other primitive data types, it does not have any literal form. It is a built-in object whose constructor returns a symbol that is unique.
bigint The bigint type represents the whole numbers that are larger than 253-1. To form a bigint literal number
Object It is the most important data-type and forms the building blocks for modern JavaScript.

Array

An array in JavaScript is a data structure used to store multiple values in a single variable. It can hold various data types and allows for dynamic resizing. Elements are accessed by their index, starting from 0.

let a = [1, 2, 3, 4, 5];
console.log(a);

Array Method

const myArr = [0, 1, 2, 3, 4, 5];
myArr.push(6); // add new element
myArr.push(7);
myArr.pop(); // removing last element

myArr.unshift(9);
myArr.shift();

console.log(myArr.includes(0));
console.log(myArr.indexOf(9));

const newArr = myArr.join();

console.log(myArr);
console.log(newArr);

// slice, splice

console.log("A ", myArr);

const myn1 = myArr.slice(1, 3);

console.log(myn1);
console.log("B ", myArr);

const myn2 = myArr.splice(1, 3);
console.log("C ", myArr);
console.log(myn2);
const marvel_heros = ["Thor", "IronMan", "SpiderMan"];
const dc_heros = ["Superman", "flash", "Batman"];

marvel_heros.push(dc_heros);

console.log(marvel_heros);
console.log(marvel_heros[3][1]);

const allHeros = marvel_heros.concat(dc_heros);
console.log(allHeros);

const all_new_heros = [...marvel_heros, ...dc_heros];

console.log(all_new_heros);

const another_array = [1, 2, 3, [4, 5, 6], 7, [6, 7, [4, 5]]];

const real_another_array = another_array.flat(Infinity);
console.log(real_another_array);

console.log(Array.isArray("Abhishek"));
console.log(Array.from("Abhishek"));
console.log(Array.from({ name: "Abhishek" })); // interesting

let score1 = 100;
let score2 = 200;
let score3 = 300;

console.log(Array.of(score1, score2, score3));

About

In this repository is designed to help learn and master JavaScript along with concepts, preparing them for backend developer. You can read the about JavaScript from the below websites👇👇👇👇

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published