+ 1

I don't understand objects!

I don't understand how to use them, when to use them, and what it is! please help!

10th Aug 2017, 11:00 PM
BinaryNeuron
BinaryNeuron - avatar
1 Answer
+ 2
It's a fancy name for group of variables. In your browser, the whole webpage is an object: the document object. It has a width, a height, many built-in properties, and it contains every element of the webpage which are also objects: title, paragraphs, buttons, images, your username, xp points and also all the scripts and styles. They're all objects. Anything that has a name and properties is an object. In fact few things are not objects: take an image, it's just an list of pixels, but as an object we use the name to tell the browser to find it in memory, and display the correct width, height and amount of pixels. We can play with width and heigth to mess with the properties, but the content is just a bunch of pixels: we can't do anything to it. Comes in face-recognition apps: now the face in the image is an object, and we can add a funny moustache at the right place. Every language makes it sound like they invented the concept, but it exists since the 50's as soon as they needed to catalog things. If I say print "Guitar" well then that's that. But if we make a guitar object then we can use it and reuse it, give it a number of strings, a color or image, make variations (with subclass, prototype, inheritance) like bass, banjo, electric, acoustic. Without that we would have to either redefine it every time, or remember the memory locations in 0's and 1's to recall it. Now with javascript the Json format is the way to exchange objects: want to display the weather or a train schedule? Find a source and connect.
11th Aug 2017, 3:42 PM
Paulax
Paulax - avatar