SUMMARRY: 1. Array is written in brackets [ ]. 2.Array data type is an object. 3.Array can contain different data types . i.e string,number,boolean,array etc. 4. Array is zero based indexing. It starts with zero. 5. Once changed its original value will also change beacause it is non primitive (refrence) type. ARRAY METHODs : 1.Push = adds value to last of an array. 2. Pop = removes last value of an array. 3. Unshift = adds value at first of an array. 4.Shift = removes first value of an array. 5. Includes = checks true or false. 6. IndexOf = checks the position of value in number form. 7.Join = converts to string. 8. Slice(value to remove from,value remove upto but don't include)= returns new array and original value remains unchanged. Use when you need to extract a portion of an array without modifying it. 9. Splice(value to delete from, number of value to delete) = returns new array with deleted one and original value changed.Use when you need to add, remove, or replace elements within an array.
COntinuining Day 4. Arrray (25th May). => Array in a non-primitive data types. => It is used to store nultiple items under a single varible. => 18:25 slice() does not manupulate main array. => splice() manupulate original array. THANK YOU SIR JI .
Hey everyone, a huge shoutout to Hitesh Choudhary💖 for the incredible tutorials on this channel. Subscribe now to show your appreciation and gain access to these priceless resources without spending a dime!
actually there is a mistake in splice method....splice not includes last index value but it takes number of values given from starting index.....for ex: arr = [2,3,4,5,6,7,8,9] and then console.log(arr.splice(3,4)); gives 5,6,7,8.....however thank u so much hitesh sir for such valuable series...you are my favourite teacher
NOTE: slice() is non-destructive while splice() is destructive. Use splice() to add, remove or replace elements in the original array to get a new array. Happy learning.
Thank you so much, sir, for your fantastic explanation of Arrays. Your 18-minute video was extremely insightful, but I must say, I spent about 1 to 1.5 hours practicing along. I also made it a habit to glance at my notes every day. Thanks to your wonderful guidance, I now have a solid grasp of Arrays. I am truly grateful for your efforts. Honestly, your teaching style is so engaging that it sparks my enthusiasm for learning and programming. I have already charted my learning path. Once again, thank you, Sir. Your teaching is truly remarkable and greatly appreciated.
At 17:30 , one more thing about splice is : in the parameter of splice, the first one is starting index and the second parameter is length of the splice(not the ending index), Hope you find it useful
Amazing video quality, sound quality, eye soothing background and content is the king. I just love all your videos, you made my developer journey enjoyable.
thank you sir I am learning web and from where i have learned they have finished whole js in 3 days 😅 and now i am learning from your videos or previous channel videos. thank you
Array Shallow copy: reference pass hoga like in heap Deep copy: copy hi pass hoga like in stack ---------- slice(1,3): 3rd index will not be included ---------- splice(1,3): 3rd index will be included, it will also trim portion from (1->3).
Helli Sir, ur videos hv been incredibly helpful n engaging for me in my learning journey. The way u explain complex topics with clarity n provide valuable insights truly sets your content apart. ur dedication to creating high-quality study materials is evident, n I'm grateful for the effort you put into each video. I've found ur content to be a valuable resource dat has greatly contributed 2 my understanding of the subjects u cover. Thank u for ur hard work n commitment to education. Looking forward to more of ur fantastic content in the future!
17:25 The statement that the last index is also included while using splice is incorrect. Splice has second parameter which mentions delete count - number of elements to be deleted after start. So, A = [1,2,3,4,5] A.splice(2,3) will give output as [1,2]
Just for students info: The splice(1, 3) part removes 3 elements starting from index 1 (inclusive) to 3. This modifies the original myArr to [0, 4, 5]. The splice() method also returns an array containing the removed elements. In this case, it returns [1, 2, 3].
sir bohat acha bolte hain ap , ap agar movies me kam krein to is se zada hit ho skte hain by the way me pakistan Lahore se hon ak industry me kam krta hon agr ap mere comment ka jwab dein gy to acha lgy ga
wow Awesome, you covers everything. I love the quality of the content you served, I will keep commenting, I really want your channel growth as it is really helpful for deep understanding. Your content needs lots of patience to learn
Also Splicing with starting index 0 will not consider last index same as slice operation but it will consider last index for any starting index greater than 0. (at 16:46)
I just got to know a new thing, myArray.splice(3,4); it means start splicing myArray at index 3 for the count of 4 elements. It does not means start at 3rd index till 4th. Hope that helps!
=> Slice(start index, last index[not included] ) // return specific portion of the array original array don't manipulated remain same basically it creates a shallow copy of original array => Splice (start index, last index [included] ) // removes specific part of from original array and manipulate it
Hello hitesh sir just want add something in splice that (1,3) is nothing but (start, delete count, element1,etc) after deleting you can also add value or element
Sir, I appreciate the content. However, the main difference between 'slice()' and 'splice()' wasn't entirely clear. In 'slice()', the first argument sets the start index, and the second sets the end index for slicing. In 'splice()', the first argument is the start index for removing/adding elements, and the second specifies the number of elements to remove. Thank you for your explanation.
My notes of this video: // Array can be a group of mixed datatypes. It may include number, string or anther array too // It has zero based indexing. // arrays are resizable // the last element is at the value of the array's length property minus 1. // JavaScript array-copy operations create shallow copies. // A shallow copy (original copy) of an object is a copy whose properties share the same references (point to the same underlying values) // A deep copy (duplicate copy) of an object is a copy whose properties do not share the same references // Array is always defined under [] let arr = [1,2,"pranjal",true,5];// is same as let arr_ = new Array(1,2,3,4); // to add elements arr.push(6); console.log(arr); //to delete last value arr.pop(); console.log(arr); // To insert elements at the start. but it is not good as all the elements get shifted increasing the load arr.unshift(10); console.log(arr); // To delete elements at the start arr.shift(); console.log(arr); // Does it include the specified element. Returns boolean console.log(arr.includes(56)); // Index of element that does'nt exist is -1 console.log(arr.indexOf(90)); // Most important interview question: difference betn slice and splice let Myarr = [1,2,3,4,5]; console.log("A ",Myarr);// The original array let slice = Myarr.slice(1,3);// slices out element from 1 to 2 excluding 3 and original array remains same console.log(slice); // After slicing console.log("B ",Myarr); let splice = Myarr.splice(1,3);// splices out elements permanently from 1 to 3 including 3 too and manipulates the original array console.log(splice); // after splicing console.log("C ", Myarr);
Hello Sir, I am no one to make you correct . But I think Splice( ) method is used to perform insertion, deletion and updation. Eg:- myArr( a, b , c) Here, a = starting index b = number of elements to be deleted c = elements to be deleted. For eg:- const myArr = [ 10, 20, 30, 40, 50]; myArr.splice(1, 3); console.log(myArr); So here, a= 1 and b= 3. So it will start from index 1 and remove 3 elements. So, the output will be [10, 50]. Because it removed the 3 elements from index 1 i.e. [20, 30, 40] Now, In other example, const myArr = [ 10, 20, 30, 40, 50]; myArr.splice(1, 3, 60); console.log(myArr); Here, a= 1 , b= 3 and c= 60 So it will start from index 1 and remove 3 elements and then insert 60 at the place of removed elements. So, the output will be [10, 60, 50]. Because it removed the 3 elements from index 1 i.e. [20, 30, 40] and then inserted 60 at the place of removed elements.. My intention was not to spread any hatred.. I am your fan.. the way you teach us and makes coding this much simple for us is really appreciable.😍❤️ Your explaination is too good.. You are really a Brilliant Teacher.. ❤️❤️🔥
Yes, thanks for more detail explanation. In addtion, the var "C" you are denoting, i.e. "c = elements to be deleted.', I guess the better definition would be like 'The elements to add to the array' , as the third or onwards parameter are the items to be added to the original array / replace the deleted item. 🙂🙂😊😊
yes you are right also in documentation written = Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
splice(0, 3) include indexes 0, 1, 2 (not 3) splice(1,3) include indexes 1, 2, 3 (3 included) 3 is not the end index, it is the number of elements to be deleted after index mentioned as the 1st argument
low-level languages like C++ is my favourite although, I would say that there are a lot of things in JS that differ from the natural programming paradigm; it is distinct in its own right, which makes it adaptable and repeatedly useful.
if we declare variable with const that means we cannot change or update value then when we declare a variable like const array1=[1,2,4] .HERE WE CAN CHANGE VALUE IN ARRAY THEN HOW IT IS const
SUMMARRY:
1. Array is written in brackets [ ].
2.Array data type is an object.
3.Array can contain different data types . i.e string,number,boolean,array etc.
4. Array is zero based indexing. It starts with zero.
5. Once changed its original value will also change beacause it is non primitive (refrence) type.
ARRAY METHODs :
1.Push = adds value to last of an array.
2. Pop = removes last value of an array.
3. Unshift = adds value at first of an array.
4.Shift = removes first value of an array.
5. Includes = checks true or false.
6. IndexOf = checks the position of value in number form.
7.Join = converts to string.
8. Slice(value to remove from,value remove upto but don't include)= returns new array and original value remains unchanged. Use when you need to extract a portion of an array without modifying it.
9. Splice(value to delete from, number of value to delete) = returns new array with deleted one and original value changed.Use when you need to add, remove, or replace elements within an array.
thanks bro , keep doing this , God bless you
Amazinggghh
Each time I watch your playlist ,I found something unique ,nowhere I found someone using codespaces in teaching .Thanks a lot Sir.
COntinuining Day 4. Arrray (25th May).
=> Array in a non-primitive data types.
=> It is used to store nultiple items under a single varible.
=> 18:25 slice() does not manupulate main array.
=> splice() manupulate original array.
THANK YOU SIR JI .
Today is my 5th day.....
Thanks bhai🎉
yar array kaisy non-primitive h explain me
Call by reference hota h bhai. Isliye@@annaskhanoffical-006
Thank you so much sir, I'm software engineer but I do watching this series just because ur teaching style.
aap kaha job krte h
Bhai Engineer ho to reference lagwa do yaar😅
I will suggest instead of watching this focus on english
@@XrealFact he is lying
@@pramodnegi1774 bas kar ab
Hey everyone, a huge shoutout to Hitesh Choudhary💖 for the incredible tutorials on this channel. Subscribe now to show your appreciation and gain access to these priceless resources without spending a dime!
Full of contents... Got satisfied from inner heart... Thanku so much sir, for this amazing chai aur javascript series.
actually there is a mistake in splice method....splice not includes last index value but it takes number of values given from starting index.....for ex: arr = [2,3,4,5,6,7,8,9] and then console.log(arr.splice(3,4)); gives 5,6,7,8.....however thank u so much hitesh sir for such valuable series...you are my favourite teacher
right brother, thx for the update
yes you are right ,the second index is deleteCount(no of elements to be deleted)
do you meant to write(3,6)?
NOTE: slice() is non-destructive while splice() is destructive. Use splice() to add, remove or replace elements in the original array to get a new array. Happy learning.
This js series is very addictive, aapka hindi bahot sahi h, jada sahi se samajh me aa raha h. Thanks Hitesh.
It is amazing, I take so many JS courses. But this one give me confidence in JS. Thanks to you
Thank you so much, sir, for your fantastic explanation of Arrays. Your 18-minute video was extremely insightful, but I must say, I spent about 1 to 1.5 hours practicing along. I also made it a habit to glance at my notes every day. Thanks to your wonderful guidance, I now have a solid grasp of Arrays. I am truly grateful for your efforts. Honestly, your teaching style is so engaging that it sparks my enthusiasm for learning and programming. I have already charted my learning path. Once again, thank you, Sir. Your teaching is truly remarkable and greatly appreciated.
Thanks for kind words.
Stay tuned, more videos to come
@@chaiaurcode sir kabhi live bhi ayn
@@chaiaurcode i am yours big fan because your teaching method is awesome and nice and amazing
Hitesh Sir hazaron Saal Jiyee ap, buhat heavy content ha. Thanks a lot.
At 17:30 , one more thing about splice is : in the parameter of splice, the first one is starting index and the second parameter is length of the splice(not the ending index), Hope you find it useful
"The way Chai aur Code breaks down complex concepts is nothing short of genius. Thank you!"
I watched entire english series still I am watching your this series cause I get something new everytime 🥰😇
Amazing video quality, sound quality, eye soothing background and content is the king. I just love all your videos, you made my developer journey enjoyable.
thank you sir I am learning web and from where i have learned they have finished whole js in 3 days 😅 and now i am learning from your videos or previous channel videos. thank you
same in my college
i think, this playlist is actually lies among the best playlist in the youtube.
Array
Shallow copy: reference pass hoga like in heap
Deep copy: copy hi pass hoga like in stack
----------
slice(1,3): 3rd index will not be included
----------
splice(1,3): 3rd index will be included, it will also trim portion from (1->3).
explained in so depth .......Thank u so much sir for such an amazing playlist.💖💖
14/51 done [5.1.24] ✅✅
sir apka way of teaching bhot acha h but usse jyda apka smile or expression apke pdhane ko or intresting kr deta h litrally bhiya
Waah sir phli baar coding enjoy kr raha hu♥️💪🔥🙇🙇🙇
Finally Array ✅♥️, love you guruji ♥️
We always waiting for you video lecture.
Vacation hogaya sir aapka
We are waiting for next video in javascript playlist.... 😊
bhaut kuch sikh raha hu sir ,,,, Your teaching style is excellent ...
Amazing maza gaya sir .... This playlist is gonna make us almost interview ready ..thanks a ton hitesh sir 🔥❤️
Love From Pakistan
Amazing explanation❤
Helli Sir, ur videos hv been incredibly helpful n engaging for me in my learning journey. The way u explain complex topics with clarity n provide valuable insights truly sets your content apart.
ur dedication to creating high-quality study materials is evident, n I'm grateful for the effort you put into each video. I've found ur content to be a valuable resource dat has greatly contributed 2 my understanding of the subjects u cover.
Thank u for ur hard work n commitment to education. Looking forward to more of ur fantastic content in the future!
can't we give multiple likes ? bcoz this is indeed great tutorial !! 🔥🔥
best Series ALL OVER UNIVERSE, thank you Sir 🙏
17:25 The statement that the last index is also included while using splice is incorrect.
Splice has second parameter which mentions delete count - number of elements to be deleted after start.
So,
A = [1,2,3,4,5]
A.splice(2,3) will give output as [1,2]
thanks, i was confused too
very good teching experience and way of teaching is really great love this amazing
Explanation way is much better , its easy to understand
Sir you are the motivation of all newbie software developers. Thank you so much sir for this videos.... Take love🥰
Very well explained sir, thank you for such amazing content
Thanks, keep learning
18:02 This minute detailled khnowledge is very rare in YT
Slice and Splice wala concept kafi mast bataya sir aapne, 21 topo ki salami milni chahiye aapko 😅
Just for students info:
The splice(1, 3) part removes 3 elements starting from index 1 (inclusive) to 3. This modifies the original myArr to [0, 4, 5].
The splice() method also returns an array containing the removed elements. In this case, it returns [1, 2, 3].
Great content . I am surprised jaha pr array pr discussion khatam hota ha baki channels pr yaha pr waha se start hota ha . Hats off
Maza aagaya bhayya .
Upload videos regularly...
Bs hopefully ab software crash nhi hoga to roz hi video upload krenge
@@chaiaurcode sir plzzz in Particular topic p VVEsy qs de ap taaaki hm practice krskee. leetcode wghera p tough Qs h for us like absolute Beginners.
Thanks for such nice informative series.
sir bohat acha bolte hain ap , ap agar movies me kam krein to is se zada hit ho skte hain by the way me pakistan Lahore se hon ak industry me kam krta hon agr ap mere comment ka jwab dein gy to acha lgy ga
Very nice explanation sir ji👌👌
Hitesh bhai aap aik playlist Time aur Space Complexity k analysis pe bhi bnaiye ga please.
I can't thankyou more for explaining Array so easy so well frame, I understand it very well, thankyou so much
nice
Learning from you makes my concept crystal clear.This is why I love to learn from you sirjiii.
Thank you so much sir, very good explancation of arrays and very helpful video,
Thanks sir. Please upload videos of interview questions and related. Please
i started playlist 2 days ago and i love it and complete it as soon as possible
Thank you for UA-cam ka Best series
Thank you sir for better explanation
Sir your teaching style is so good as compares to other teachers.......Love u sir
Thank you Best tutorials Hitesh Sir
wow Awesome, you covers everything. I love the quality of the content you served, I will keep commenting, I really want your channel growth as it is really helpful for deep understanding. Your content needs lots of patience to learn
can u please explain me the slice and splice part
Amazing lecture
Best man
Amazing explanation❤
Big respect
Awesome 👍
Also Splicing with starting index 0 will not consider last index same as slice operation but it will consider last index for any starting index greater than 0. (at 16:46)
Note splice Syntax:
splice(start, optional delete count, optional items to add)
I just got to know a new thing,
myArray.splice(3,4);
it means start splicing myArray at index 3 for the count of 4 elements.
It does not means start at 3rd index till 4th.
Hope that helps!
Best teacher on UA-cam
Unique style Pushpa jaisa
Thanku so much you explain it very simply Sir ☺️😇
Such a great lecture sir love it
sir yeh ap ki videos mein shaktiman aur naagraj kia hain🤔🤔
best video of javascript arrays
Congratulations for 300K Hitesh sir :)
Thanks 🤗☕️
thanks you so much sir maja agaya
apni language me kuchh sikhne me bohot easy hota hain one more time thanks sir
Thanks alot sir really enjoyed learning❤
thanks sir nice class
Thanks a lot sir your videos are such a bless.
=> Slice(start index, last index[not included] ) // return specific portion of the array original array don't manipulated remain same basically it creates a shallow copy of original array
=> Splice (start index, last index [included] ) // removes specific part of from original array and manipulate it
great video
Hello hitesh sir just want add something in splice that (1,3) is nothing but (start, delete count, element1,etc) after deleting you can also add value or element
🎉Nice Teaching Methodology Sir....a kind request, if you have a time please compose JAVA-SE Tutorial.....😊
JAVA In HINDI tutorial Sir 🙏
Best lecture on internet
Love from Pakistan
4 years of college ❌ Hitesh sir ✅💀☠️ love from Pune❤
Sir, I appreciate the content. However, the main difference between 'slice()' and 'splice()' wasn't entirely clear. In 'slice()', the first argument sets the start index, and the second sets the end index for slicing. In 'splice()', the first argument is the start index for removing/adding elements, and the second specifies the number of elements to remove. Thank you for your explanation.
Splice ke andr jo dusra no jata hai wo no of elements starting from first input hai
3:35 wait and read it whole
My notes of this video:
// Array can be a group of mixed datatypes. It may include number, string or anther array too
// It has zero based indexing.
// arrays are resizable
// the last element is at the value of the array's length property minus 1.
// JavaScript array-copy operations create shallow copies.
// A shallow copy (original copy) of an object is a copy whose properties share the same references (point to the same underlying values)
// A deep copy (duplicate copy) of an object is a copy whose properties do not share the same references
// Array is always defined under []
let arr = [1,2,"pranjal",true,5];// is same as
let arr_ = new Array(1,2,3,4);
// to add elements
arr.push(6);
console.log(arr);
//to delete last value
arr.pop();
console.log(arr);
// To insert elements at the start. but it is not good as all the elements get shifted increasing the load
arr.unshift(10);
console.log(arr);
// To delete elements at the start
arr.shift();
console.log(arr);
// Does it include the specified element. Returns boolean
console.log(arr.includes(56));
// Index of element that does'nt exist is -1
console.log(arr.indexOf(90));
// Most important interview question: difference betn slice and splice
let Myarr = [1,2,3,4,5];
console.log("A ",Myarr);// The original array
let slice = Myarr.slice(1,3);// slices out element from 1 to 2 excluding 3 and original array remains same
console.log(slice);
// After slicing
console.log("B ",Myarr);
let splice = Myarr.splice(1,3);// splices out elements permanently from 1 to 3 including 3 too and manipulates the original array
console.log(splice);
// after splicing
console.log("C ", Myarr);
Great Video Hitesh Sir
sir class ka end main aik project kariya karin
Better examples for others:
const fruits = ["Apple", "Banana", "Cherry", "Date", "Elderberry"]; // Original array
// Using slice
const slicedFruits = fruits.slice(1, 4); // Copies elements from index 1 to 3 (index 4 excluded)
console.log("Sliced:", slicedFruits); // Logs: ["Banana", "Cherry", "Date"]
console.log("Original after slice:", fruits); // Original array remains unchanged
// Using splice
const splicedFruits = fruits.splice(1, 3); // Removes 3 elements starting from index 1
console.log("Spliced:", splicedFruits); // Logs: ["Banana", "Cherry", "Date"]
console.log("Original after splice:", fruits); // Modified array: ["Apple", "Elderberry"]
Nice Lecture Sir thanks for it
Chass a gai... really awesome bro.😊
woah didn't know about that splice thingyt NIce! Much Respect for you!
cool
Hello Sir, I am no one to make you correct . But I think Splice( ) method is used to perform insertion, deletion and updation.
Eg:- myArr( a, b , c)
Here, a = starting index
b = number of elements to be deleted
c = elements to be deleted.
For eg:-
const myArr = [ 10, 20, 30, 40, 50];
myArr.splice(1, 3);
console.log(myArr);
So here, a= 1 and b= 3.
So it will start from index 1 and remove 3 elements.
So, the output will be [10, 50]. Because it removed the 3 elements from index 1 i.e. [20, 30, 40]
Now, In other example,
const myArr = [ 10, 20, 30, 40, 50];
myArr.splice(1, 3, 60);
console.log(myArr);
Here, a= 1 , b= 3 and c= 60
So it will start from index 1 and remove 3 elements and then insert 60 at the place of removed elements.
So, the output will be [10, 60, 50]. Because it removed the 3 elements from index 1 i.e. [20, 30, 40] and then inserted 60 at the place of removed elements..
My intention was not to spread any hatred.. I am your fan.. the way you teach us and makes coding this much simple for us is really appreciable.😍❤️
Your explaination is too good.. You are really a Brilliant Teacher.. ❤️❤️🔥
Yes, thanks for more detail explanation. In addtion, the var "C" you are denoting, i.e. "c = elements to be deleted.', I guess the better definition would be like 'The elements to add to the array' , as the third or onwards parameter are the items to be added to the original array / replace the deleted item.
🙂🙂😊😊
@@deepakshrestha2672 Yes Bro❤️
yes you are right also in documentation written = Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
thanks brother , keep this work continue where you can add something more
The two arguments splice takes is starts index and delete count. It's not the range you pass.
woah! lots of positive vibes.
love your teaching method sir
Aap jab padhate hai to tired feel nahi hota...lagta hai koi fairy tales sunaa raaheho
splice(0, 3) include indexes 0, 1, 2 (not 3)
splice(1,3) include indexes 1, 2, 3 (3 included)
3 is not the end index, it is the number of elements to be deleted after index mentioned as the 1st argument
low-level languages like C++ is my favourite although, I would say that there are a lot of things in JS that differ from the natural programming paradigm; it is distinct in its own right, which makes it adaptable and repeatedly useful.
c++ high level language h bhai
@@MohitYadav-o4z9z research
Watching before my interview ❤
Thanks sir❤❤
Loving All Your Videos
if we declare variable with const that means we cannot change or update value then when we declare a variable like
const array1=[1,2,4] .HERE WE CAN CHANGE VALUE IN ARRAY THEN HOW IT IS const
Shallow copy aur deep copy ki koi real-world example share kr dein please.
Thank you so much sir 😊