Java ScriptObjects

Owali Ullah Shawon
2 min readMay 5, 2021

An object is a thing that has many properties of its own. If you think you are a human being, then your hands, feet, ears, eyes are all property. Or your name, age, these are properties.

There are two basic ways to create a blank object -

Here you can do it with var or const, see the variable chapter for where you will find out details.

var obj = new Object(); var obj = {};

These both are the same for an object.

Here you are setting some properties of a human ‘Man’ object with name, age, job name.

Now you can set as many more objects inside an object as you want. Suppose there are many leagues in football and there is in every league that many teams are playing.

Here an object named ‘education’ is set inside another object ‘Man’.

It is good to know that we cannot use any reserved word as the property name.

A word like ‘For’ cannot be used. If you want to use it, you can do it before adding a letter with something.

_For if there is no problem again.

We can do this together when accessing attributes if we want. Dot or bracket can be done either way.

Man.name is the same as Man [‘name’]: D

Here an object named ‘Person’ is being created whose prototype ‘you’ is being passed You & 24.

Again we can access the property in two ways with dot or bracket notation as before.

--

--