My journey continues on the Bootcamp, i viewed the javascript object and did the assignment suggested. As the pictures indicate below:
Javscript object assignement :
/ Create an object with one of each data type including at least 1 method.
// Call the method to make it execute.
// The method must use the keyword "this" to reference some part of the object.
var Person ={
name: "Tom",
Tel: "123",
age: 20,
friends: ["Jerry", "Carl","Timo"],
adress: {
street:"Bahn",
city: "zuri"
},
newInfos: function(){
console.log(this.age)
}
}
console.log(Person.newInfos())
^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
create At least 3 nested levels of data (including objects and arrays)
At least 1 method
Add 2 properties to one of the objects (doesn't matter what level of nested data you do this to)
Add 2 items to at least one of the arrays in your data
// Javascript Objects Part 2
var Person ={
name: "Tia",
age: 23,
travel:["France","USA", "Canada"],
location:{
street:"strasse",
number:123
},
family:[{Husband:{
name:"Bob",
age:25
},
kids:{
name: "To",
age:2,
friends:{
name:"Obi",
age: 3
}
}
}]
}
^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Write a for loop that prints to the console the numbers 0 through 9.
for(var i=0;i<10;i++){
console.log(i)
}
Write a for loop that prints to the console 9 through 0.
for(var i=9;i>=0;i--){
console.log(i)
}
Write a for loop that prints these fruits to the console.
var fruits= ["Banana", "Apple","Orange","kiwi"]
for(var i=0;i<fruits.length;i++){
console.log(fruits[i])
}
Write a loop that pushes the names into a names array, and the occupations into an occupations array.
var Persons= []
for(var i=0; i<3;i++){
Persons[i]= {
name:"Timo"+ i+1,
occupation:"Teacher"+ i+1
}
}
console.log(Persons)
[{name: "Timo01", occupation: "Teacher01"}, {name: "Timo11", occupation: "Teacher11"},
{name: "Timo21", occupation: "Teacher21"}]
The bootcamp offers very good assignment, from the easiest to the most difficult. it helps a lot to understand the lessons.
I continue typing and English lessons every day.
Jean Cédric NTWARI