Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let arr = [
- {
- PERSON: {
- name: "Barry Johnson",
- age: 17,
- fav_color: "Green",
- list_of_hobbies: {
- hobby_1: "Music Production",
- hobby_2: "Video Production",
- hobby_3: "Shitposting" //dont judge Barry
- },
- },
- }
- ];
- // will not work???
- function console_print(arr){
- for(let i = 0; i < arr.length; i++){
- for(hobby in arr[i].list_of_hobbies){
- console.log(arr[i].list_of_hobbies[hobby]);
- }
- }
- }
- //will work???
- function print_obj(arr){
- for(let i = 0; i < arr.length; i++){
- if(i % 2 == 0){
- console.log(arr[i]);
- }
- }
- }
- print_obj(arr);
- console_print(arr);
- //theres no html doc or anything its just linked to a blank html doc so I can use the console
Add Comment
Please, Sign In to add comment