JavaScript Chapter 5 - Practice Set on Arrays | JavaScript Tutorial in Hindi #21

preview_player
Показать описание

python, C, C++, Java, JavaScript and Other Cheetsheets [++]:

►Learn in One Video[++]:

►Complete course [playlist]:

Follow Me On Social Media
Comment "#HarryBhai" if you read this 😉😉
Рекомендации по теме
Комментарии
Автор

Handwritten Notes access karein and apne gao ki zameen mere naam karein 🤣😅

CodeWithHarry
Автор

Hahahaha 😂 big boss mujhe hurt ho rha hai gazab Harry bhai 🔥❤️

puneetshakya
Автор

Those who are not able to use prompt in replit, use this line at the very beginning of the code:-
const prompt = require("prompt-sync")()

lol_me
Автор

let arr = [1, 2, 3, 4];
let num = prompt("Amount of update");
let newNumber;
let i = 0;
while(i < num){
newNumber = prompt("Enter your number")
++i
arr.push(newNumber)
console.log(arr);
}

This is for when you have to decide how many number your want to add in your array
First you have to give the Number of value you want to add and and the give the value you want to add

AbhishekThakur-weub
Автор

Haris bhai JazakALLAH i did it for first time JazakALLAH
let bdc = prompt("enter your number")
let abc = [1, 2, 4, 5, 6, 7, 8]
let ddc = abc.push(bdc);
console.log(abc)

Mubashir
Автор

Bhai sab batain alag Par Thumbnail Man Bht cute Lagta ho ❤️❤️❤️💜

muneebkarim
Автор

Q1. Create an array of numbers and take input from the user to add numbers to this array.
Q2. Keep adding numbers to an array in Q1 until the user adds 0.
Q3. Filter the numbers that are divisble by 10 from an array.
Q4. Create an array of squares of a given number
Q5. Use reduce to calculate the factorial of a given number from an array of first n natural numbers. (n being the numbers whose factorial needs to be calculated)

HuzaifaMuhammadSIddique
Автор

You teaching style is totally different from everyone and this style make us so simple to understand complex things. Thanks for such an valuable course. JS rocks..Harry you are awesome 👏

soumyajitsatpathy
Автор

namaste harry Bhai !! Hum Nepal se hey...Apka Python series complete kar chuka aur JS ka bhi mast hey aab tak....Dil se bahut khusi lagta hey bhai apka videos dekh kar...Thank you sooo much brother from my bottom of heart !

jhszjmq
Автор

Definately . It is the best course on javascript even better than the paid ones. I am learning and enjoying your videos . I hope everyone will complete the series ....

utpalnath
Автор

One of the best playlist I have seen for javascript. I have learnt javascript during my college placement but aftet that i got the job in a company where I have mostly worked on sql but currently I am looking for a front end role I know most of the concepts already but during interveiw they asked basics thats why watching your videos from last 2 days on 1.5x speed just to revise everyhting

vivekmishra
Автор

Blockchain related projects and videos

praneethsai
Автор

6:24 for Those who want to solve it using while loop
a = [2, 3, 4, 5]
let b
while (b != 0) {
b = prompt("Enter The Number to be pushed : ")
b = Number.parseInt(b)
a.push(b)
}
console.log(a);

shydcuk
Автор

// Here the all answer of chapter 5
//


// Practice set 1
let marks = [45, 98, 67, 42, 65, 75, 87];
let newmarks = prompt("Enter Marks you want to add: \t");
newmarks= Number.parseInt(newmarks)
marks.push(newmarks);
console.log(marks);


// Practice set 2
let marks = [45, 98, 67, 42, 65, 75, 87];
let add;
do{52
add = prompt("Enter Marks: ");
add = Number.parseInt(add);
marks.push(add);
}while (add != 0);
console.log(marks);


// Practice set 3
let marks = [45, 90, 60, 42, 70, 75, 80];
let divied = marks.filter((x) =>{
return x % 10 == 0;
});
console.log(divied);


// Practice set 4
let marks = [1, 2, 3, 4, 5, 6, 7, 8, 9];
let squre = marks.map((x) =>{
return x * x;
})
console.log(squre);


// Practice set 5
let marks = [1, 2, 3, 4, 5, 6];
let fectorial = marks.reduce((x, y)=>{
return x * y;
})
console.log(fectorial);

mridulghoshshanto
Автор

Q NO. 1 --> Extended version

const arr=[];
let n=Number(prompt("How many numbers do you want to add in the array?"));
for(i=0;i<n;i++){
let arr_num=Number(prompt( `Enter number ${i+1}:`));
arr.push(arr_num);
}
console.log(arr);

sgyqezu
Автор

Code to find the factorial of any number


let arr = []
let a;
a = prompt("Enter the number ");
a = Number(a);
let x = a;

if (a == 0) {
++a;
arr.push(a);
}

do {

arr.push(a);
a--;

} while (a > 0);

let b = arr.reduce((p, q) => {
return p * q;
})

console.log("The Factorial of ", x, " is ", b);

Thanku harry bhai or sir (:

r_gmer
Автор

Extented version of question 5 in which no array is given before and only you have to enter a number, is here you can consider that as a reference:

let a = Number.parseInt(prompt("Enter a Number:"));

let arr = [];

while(a!=0){
arr.push(a);
a--
}

const factorial = (x, y)=>{
return x * y;
}

let newArr = arr.reduce(factorial);

console.log(newArr);

🙌

pandat
Автор

Seriously harry i never ever given any likes or comments in any posts of facebook, instagram videos or any youtube videos but after seeing of your js playlist I have to give a like or Comment so thanks a lot harry recently i started my course with watching your videos only 👍.

azheruddin
Автор

aapne meme ka sahi upyog kiya hai harry bhai...padhe padhe hasne lagta hu to ghar wale bhi sochte hai ki beta coding sikhne ke chakkar mein pagla gaya work

abhinavshukla
Автор

// Chap no 5 practice problem no 1;

let arr = [''];

for (let i = 0; i < arr.length; i++) {

if(i < 5)
{
let a = prompt('Enter Your Value');
a = Number.parseInt(a);
arr.push(a);
}
else
{
if(i==5)
{
arr.shift();
console.log(arr);
}

}

}


Thank You Harry Bahi

talharashid