0% found this document useful (0 votes)
3 views1 page

Understanding JavaScript Arrays and Functions

The document provides an overview of arrays in JavaScript, detailing their structure, properties, and methods for data manipulation. It explains concepts such as indexing, mutability, and various array methods like push, pop, and sort. Additionally, it touches on loops and functions, emphasizing code reusability and iteration in programming.

Uploaded by

rk2493853
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Understanding JavaScript Arrays and Functions

The document provides an overview of arrays in JavaScript, detailing their structure, properties, and methods for data manipulation. It explains concepts such as indexing, mutability, and various array methods like push, pop, and sort. Additionally, it touches on loops and functions, emphasizing code reusability and iteration in programming.

Uploaded by

rk2493853
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Array

Saturday, 31 May 2025 10:15

Array first -> data structure

Organizing , using , again storing the in such way so that data can easily access in future
JavaScript ->
1. Jo multiple value store
2. Single variable
3. Multiple type ki bhi Int , float , string , Boolean
4. Data index wise distribute hojaaye
5. 0 base index
6. Size - 0 Class -> 200 -> 200 marks ->
7. Length - 1
Collection of multiple data in a linear format 200 variable ->
Size = length - 1 Array -> marks -> 200 marks ->

Marks = [12,43,56,43,56,86,45,76…….]
Stud = [2,4,6,8,10]
Data fetch ???? Index -> array indexing-> zero base
indexing
School - 100 student ->
S1 Marks[0[ -> 12
S2
S3 Marks -> size -> 0 ->
S4 Length -> 1

Size = length - 1
Mutable -> index wise
Let Student = ["Mukesh" , 29, 98.5]
let student = [12,34,23,65,78] // number Mixed array
let names = ["mukesh" , "Sahil" , "Bhavya"] // string
let info = ["Mukesh" , 22 , 9.8] // mixed Javascript -> numbers ->
Let arr = [];

Array Methods ->

1. Push - add at the end


2. Pop - Delete from end & return it
3. Unshift - Add to start
4. Shift - delete from start & return it
5. Indexof(ele) -- index
6. Includes(ele) - exist krtha hai ya nhi
7. Concat -> merge
8. Reverse -> reverse the index
9. Slice -> si , ei --- ei not included
10. Splice -> remove | replace | add the element --- original
11. Sort()

Array reference ->

Let arr1 = [1]


Let arr2 = [1]

Variable -> Address value pr store hue hai

Constant ->

Const arr = [1,2,3,4]

1. Function ->
2. Mutable -> koi diff const ya normal arr refer kro ->

Loops ->

1----- 100 ----- I++ -> print("he;llo")


Hello world - 10 ->

Set of iteration -> which run on the basis of condition- when condition meet -> loop will end

Source / start / intialization I =


Condition / end / destination
Increment / dec / updation

While loop
For loop

Break -> jesi break hoga , condition tut jaegi -> all condition
Continue -> jesi continue -> woh us particular condition ko buypass krdega

Implement -> style of code ->

Function -> 1 chance ->

20 sum -> 40 Sum(a,b)


Block of code -> code reusability
Function always used in logic definition 20 sum
20 display ->

2 number -> 20 baar ---- 1 chance [Link](A+b)

A+b
Sum(10,20)
Sum(10,20)
1. Function is always created outside -> Sum(10,20)
2. Function consist of function name -> ----- name -- threw us logic ko use kr saaku Sum(10,20)
Sum(10,20)
Sum(10,20)
Sum(10,20)
Function hello(){
[Link]("hello")
[Link]("hello")
[Link]("hello")
[Link]("hello")
[Link]("hello")
[Link]("hello")
}

Function return ->

Pre define

User define

You might also like