WHAT IS ARRAY
Multiples value store one countries.
Looping can't used array because variable different.
First variable, all set same name.
Array index value go => 0,1,2,3,4,5..., etc.
Starting number value zero.
Dynamic size - Value change for any time (User).
-
main one is Array symbol []
square bracket.
Examples
JavaScript Array program
Couny of Fail
_________________________________Explain about fail count :
- First create Array variable name marks and value
- Next create variable name fail and second variable name i .
- Create While loop in i < less than 5
- if condition marks [i] < less than 35 ,i variable name is set because (say in 6 point)
- fail variable in post increasesquare bracket i<35 condition true go inside and fail ++ work
- i ++ variable also post increase,is 0+1=1, again 1+1=2 again again five time run loop this loop condition fail loop repeat.
- The Finally part in Output used console.log (fail) _________________________________ fail and pass count
Output
Explain about fail and pass count :
- First create Array variable name marks and value
- Next create variable name fail ,pass variable and second variable name i .
- Create While loop in i < less than 5
- if condition marks [i] < less than 35 ,i variable name is set because say in 6 point
- fail variable in post increase
- i ++ variable also post increase,this loop condition fail loop repeat.
- if condition fail and used of else condition inside pass++ post increase
- The Finally part in Output used console.log ("Fail ",fail), console.log ("Pass ",pass) _________________________________
Total of marks
Explain about Total marks:
Output
Explain about Total marks:
- Same create Array marks name variable [22,30,12,45,78] this value are sum.
- Create two variables (i) let total (ii) let i two value is 0.
- Create While loop because now all variable name is same (Explain 6 point )
- i < less than 5 this is loop condition
- total =total + marks [i] ,what is line i Explain- total value 0 + marks value
ex0+1 =1, 1+1=2,2+1=3,3+1=4 Finally 4+1=5 loop stop because 5 less than 5 fail - The i variable increase in i++ condition, this is a i variable value change for loop runtime (ex)- 0 > 1 > 2 > 3 > 4
- Than last step come the Output, used console.log ("Total mark -", total)"" Quotation mark is a string than another topic.
*Array is Dynamic value and different variable store one place used
*
_That's all thank you 😊 _






Top comments (0)