0
Cant understand objects
Objects
3 Antworten
0
An object in programmation is the same that an object in real life. For exemple, a computer in an object and it has attributes, like the size of the screen, the color, ... and a computer also have methods, like when it opens when you turn it on or when a letter is printed when you press it...
So, an object in programmation has attributes and methods, attributes are the variables and methods are the functions.
0
//function
function person (name, age) {
this.name = name;
this.age = age;
}
// this goes to the function
//person(name,age)
var John = new person("John", 25);
var James = new person("James", 21);
//here we need var john age so it take just the age from function for the var john
document.write(John.age);
//output 25 cz john have age 25
0
now programming what do you know about an object.
"a material thing that can be seen and touched".
In programimg
object a variable. you put data or attributes on it.