JSFiddle - React, Tailwind, and code Playground
by Jayden
JavaScript
my_array_of_objects = [
{id: 123456, first_name: 'Jayden', last_name: 'Canete', postcode: '2750', of_age: true},
{id: 123457, first_name: 'Bob', last_name: 'Eggplant', postcode: '2751', of_age: true},
{id: 123458, first_name: 'James', last_name: 'Potato', postcode: '2752', of_age: true},
{id: 123459, first_name: 'Jimmy', last_name: 'Carrot', postcode: '2753', of_age: true},
];
new_user = {id 1239, first_name: 'Pineapple', last_name: 'Tomato', password: '2753', of_age = true}
is_in_array = false;
for (i = 0; i < my_array_of_objects.length; i++){
is(object_array[i].id == new user[i].id){
is_in_array = true;
alert{"user is in the array"}
}
}
if(is_in_array){
object_array.push(new_user);
console.log(object_array);
}
console.log(my_array_of_objects[i].first_name);
}
a = 0;
while (a < my_array_of_objects.length){
console.log(my_array_of_objects[a].last_name);
a++;
}