Комментарии:
Hi Aksahy, I am so grateful to you... You make my javascript concepts so clear that , I got offer from 5 companies and going to join a good company with 110% hike.
I really believe your content is worth payable. Thank you so much 🙌🙌🙌🙌
Keep educating and spreading love and knowledge. 🥳🥳🥳
const output=arr.reduce((acc,curr)=>
{
if(curr.age<30)
{
acc.push(curr.first_name)
}
return acc
},[])
const output = users.reduce(function(acc, curr){
if(curr.age < 30){
acc.push(curr.firstName);
}
return acc
},[])
console.log(output)
const users =[{firstName:'colin',lastName:'CThomas',age:21},
{firstName:'Virat',lastName:'Kohli',age:20},
{firstName:'Cristiano',lastName:'Ronaldo',age:20}
]
const value=users.reduce( (acc,cur) =>{
if(cur.age>20)
{
acc.push(cur.firstName)
}
return acc
},[])
const users = [{firstName:"akshay" ,lastName:"saini",age:26},
{firstName:"donald" ,lastName:"trump",age:75},
{firstName:"elon" ,lastName:"musk",age:50},
{firstName:"deepika" ,lastName:"padukone",age:26}
];
const output=users.reduce(function(acc,curr)
{
if(curr.age<30)
{acc.push(curr.firstName);
}
return acc;
},[]);
console.log(output);
const users = [
{
name : "Sai",
age : 23
},
{
name : "siri",
age : 22
},
{
name : "guna",
age : 20
},
{
name : "kiran",
age : 21
},
{
name : "joel",
age : 19
}
];
const output = users.reduce((acc,curr) => {
if(curr.age > 21){
acc.push(curr.name)
}
return acc
},[])
console.log(output)
thx man
ОтветитьPrinting full name
let persons =[
{ fname :"Manish" , lname :"Kumar" , age:27},
{ fname :"Ranjeet" , lname :"Kumar" , age:26},
{ fname :"Abhimanyu" , lname :"Kumar" , age:22},
{ fname :"Raj" , lname :"Kumar" , age:27},
{ fname :"Rakesh" , lname :"Kumar" , age:22}
]
// Print the full name which has age > 25
// short form : solution 1
let output = persons
.filter(x=>x.age>25)
.reduce((acc, curr) =>{
acc.push([curr.fname ,curr.lname].join(' '))
return acc
},[])
console.log(output)
// [ 'Manish Kumar', 'Ranjeet Kumar', 'Raj Kumar' ]
// other way : solution 2
function getAge(item){
return item.age>25
}
let filterArr= persons.filter(getAge)
let reduceArr = filterArr.reduce((acc, curr)=>{
acc.push([curr.fname, curr.lname].join(" "))
return acc
},[])
console.log(reduceArr)
My solution to the home work :
const users = [
{ firstName: "akshay", lastName: "saini", age: 26 },
{ firstName: "donald", lastName: "trump", age: 75 },
{ firstName: "elon", lastName: "musk", age: 50 },
{ firstName: "déepika", lastName: "padukone", age: 26 },
];
// ("akshay", deepika]]
const output = users.reduce(function (acc, curr) {
if (curr.age < 30) {
acc.push(curr.firstName);
}
return acc;
}, []);
console.log(output);
waiting next videos
Ответитьusers.reduce((arr, cur)=>{
if(cur.age<30) arr.push(cur.firstName);
return arr;
});
let challengeOutput = users.reduce(function(acc,curr){
if(curr.age<30){
acc.push(curr.firstName)
}
return acc;
},[]);
const users = [
{firstName: "akshay", lastName: "saini" , age: 26},
{firstName: "donald", lastName: "trump" , age: 75},
{firstName: "elon", lastName: "musk" , age: 50},
{firstName: "deepika", lastName: "padukone" , age: 26},
]
const output = users.reduce((acc, user)=> {
user.age > 30 && acc.push(user.firstName)
return acc
}, [])
console.log(output)
Loved it😍
Ответитьconst output = users.reduce((acc,curr)=>{if(curr.age<30){acc.push(curr.firstName)}},[])
Ответитьconst output = users.reduce((acc, curr) => {
if (curr.age > 30) {
acc.push(curr.firstName);
}
return acc;
}, []);
let res=arr.reduce((acc,cv)=>{
if(cv.age<24){
acc.push(`${cv.firstName} ${cv.lastName} is ${cv.age} year old`)
}
return acc
},[])
good shit brother, good video
Ответитьreduce is beautiful
Ответитьconst name = user.reduce((acc,curr)=>{
if (curr.age < 30) {
acc.push(curr.Name);
}
return acc;
}, []);
console.log(name);
H.W:
const ans= obj.reduce((acc, curr)=> {
if(curr.age >= 21){
acc.push(curr.firstname);
}
return acc;
},[])
find the users First Name that has age is less than 30 ? and Ans =>
const output=users.reduce(function(acc,curr){
if(curr.age<30){
acc.push(curr.firstName)
}
return acc
},[])
console.log(output);
const rdi= users.reduce((acc,curr)=>{
curr.age<30?acc.push(curr.firstname):0;
return acc
},[])
console.log(rdi)
const user = [
{ firstName: 'Eden', lastName: 'Hunter', age: 34 },
{ firstName: 'Bud', lastName: 'Foster', age: 21 },
{ firstName: 'Herbert', lastName: 'Allen', age: 56 },
{ firstName: 'Derick', lastName: 'Nichols', age: 34 },
{ firstName: 'Urban', lastName: 'Mack', age: 10 },
];
const output = user.reduce((acc, curr) => {
if (curr.age < 30) {
acc.push(curr.firstName);
}
return acc;
}, []);
console.log(output);
This is my homework
/***************************/
const output = arr.reduce(function (acc, cur) {
if (cur.age < 21) {
acc.push(cur.firstname);
}
return acc;
}, []);
/***************************/
Hi Akshay Sir Thank you for sharing your knowledge I was so confused about the concepts and pull my hairs like how the things done but with your way of teaching and your support make me fall in love with the javascript and now I understand the concepts way better than before . Thank you Thank you Thank you Thank you Thank you Thank you a big Thank you for sharing your knowledge with us.
Ответитьconst firstName = user.reduce((acc, curr) => {
if (curr.age < 30) {
acc.push(curr.firstname);
}
return acc;
}, []);
const output=arr2.reduce((acc,curr)=>{
if(curr.age<30){
acc.push(curr.firstName)
}
return acc
},[])
Thank you so much.
Ответить//using reduce
const fnRedyce = users.reduce((acc,curr) => {
if(curr.age<30){
acc=acc + curr.firstName
}
},[])
console.log('age<30 using reduce',fnAgeLessThan30);
@akshaymarch7 solution for finding firstname with age < 30 using reduce
const firstName = users.reduce((acc, curr) => {
if (curr.age < 30) {
acc.push(curr.firstName);
}
return acc;
}, []);
const users = [
{first:'aniket',age:22},
{first:'aniket1',age:33},
{first:'aniket2',age:22},
{first:'aniket3',age:55},
{first:'aniket3',age:55},
{first:'aniket4',age:65},
]
// const ans = users.reduce((acc,curr)=>{
// if(acc[curr.age]){
// acc[curr.age]++;
// }
// else{
// acc[curr.age]=1;
// }
// return acc;
// },{})
const ans = users.reduce((acc,curr)=>{
if(curr.age >10){
acc.push(curr.first)
}
return acc;
},[])
console.log(ans)
const output = arr.reduce((names, currentItem) => {
if(currentItem.age < 30) {
names.push(currentItem.firstName);
}
return names;
},[])
const output = users.reduce(function (acc, curr) {
if(curr.age < 30) {
acc.push(curr.firstName);
}
return acc;
}, [])
console.log(output);
This is the first video i have seen in your channels. I just printed this topics in my mind . Thank you boss .
ОтветитьWith Reduce Function
Code-------------------------
let output = users.reduce((acc, curr) => {
if (curr.age < 25) {
acc.push(curr.firstName)
}
return acc
}, [])
console.log(output)
const output = user.reduce((acc , curr)=>{
if (curr.age < 30){
acc = curr.firstname
}
return acc;
},[])
console.log(output);
arr.reduce((acc,curr)=>{ if(curr.age<30) acc.push(curr.firstname); return acc},[]);
ОтветитьHey Man. You are so good. ❤ I love the way you pass detail explanations on your tutorials. Great job. Bless you
Ответитьconsole.log("reduce return number: ", this.arr.reduce((prevVal, curVal, curIndex, a) => {
console.log("filter: ", prevVal, curVal, curIndex, a, this);
return prevVal;
}));
//prevVal, curVal, curIndex, a --------all these params pass in reduce, test to run above code
const ageGroup = users.reduce(function (acc, curr) {
if (curr.age <= 35) {
acc.push(curr.firstName);
}
return acc;
}, []);
console.log(ageGroup);
U got a subscriber bro...nice video
Ответитьlet userAge22Reduce = users.reduce((acc, current) =>{
if(current.age==22){
acc.push(current.name)
}
return acc
},[])
let outs = users.reduce((acc,x)=>{ (x.age<40?acc.push(x.firstName):null)
return acc
},[])
const reduce=user.reduce((acc,curr)=>{
if(curr.age<34){
acc.push(curr.name)
}
return acc
},[])
console.log(reduce)
const users = [
{ firstName: "sudhanshu", age: 24, },
{ firstName: "shanu", age: 24, },
{ firstName: "himanshu", age: 26, }
]
const output = users.reduce(function (acc, curr) {
if (curr.age > 24) {
acc.push(curr.firstName)
}
return acc
}, [])
console.log(output);
H.W.
users.reduce(function (acc, curr) {
if (curr.age < 30) {
acc.push(curr.firstName);
}
return acc;
}, []);
const output2=users.reduce(function(acc,curr){
if(curr.age<30){
acc.push(curr.firstname);
}
return acc
},[]);
const output = user.reduce(function(acc, curr){
if (curr.age < 30){
acc.push(curr.firstName);
}
return acc;
}, [ ])
console.log(output);