filmov
tv
How to set & get Object Properties in JavaScript - JavaScript Tutorial 74

Показать описание
Notes for You:: How to set & get Object Properties in JavaScript - JavaScript Tutorial 74
D) How to Get data properties:
Syntax:
OR
objectName["propertyName"] // array notation
Example Code:
OR
E) How to Get function properties:
Syntax:
OR
objectName["propertyName"]( optional parameter list )
Example Code:
OR
F) How to Set data & function properties:
Syntax:
OR
objectName["propertyName"]=value; // array notation
where:
value can be a single data, an object, or a function
Example Code:
// setting data property
OR
rect1["width"]=6;
// setting function property
};
OR
rect1["getPerimeter"] = function(){
};
Complete code:
- Working with object created using Object constructor
var rect1 = new Object();
{
};
{
};
{
};
Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.
=========================================
Follow the link for next video:
JavaScript Tutorial 75 - Object Literal vs Object Constructor in JavaScript
Follow the link for previous video:
JavaScript Tutorial 73 - How to Add or Delete a Property of an Object in JavaScript
=========================================
JavaScript Tutorials Playlist:-
=========================================
Watch My Other Useful Tutorials:-
jQuery Tutorials Playlist:-
jQuery UI Tutorials Playlist:-
Bootstrap Tutorials Playlist:-
=========================================
► Subscribe to our YouTube channel:
► Visit our Website:
=========================================
Hash Tags:-
#ChidresTechTutorials #JavaScript #JavaScriptTutorial
D) How to Get data properties:
Syntax:
OR
objectName["propertyName"] // array notation
Example Code:
OR
E) How to Get function properties:
Syntax:
OR
objectName["propertyName"]( optional parameter list )
Example Code:
OR
F) How to Set data & function properties:
Syntax:
OR
objectName["propertyName"]=value; // array notation
where:
value can be a single data, an object, or a function
Example Code:
// setting data property
OR
rect1["width"]=6;
// setting function property
};
OR
rect1["getPerimeter"] = function(){
};
Complete code:
- Working with object created using Object constructor
var rect1 = new Object();
{
};
{
};
{
};
Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.
=========================================
Follow the link for next video:
JavaScript Tutorial 75 - Object Literal vs Object Constructor in JavaScript
Follow the link for previous video:
JavaScript Tutorial 73 - How to Add or Delete a Property of an Object in JavaScript
=========================================
JavaScript Tutorials Playlist:-
=========================================
Watch My Other Useful Tutorials:-
jQuery Tutorials Playlist:-
jQuery UI Tutorials Playlist:-
Bootstrap Tutorials Playlist:-
=========================================
► Subscribe to our YouTube channel:
► Visit our Website:
=========================================
Hash Tags:-
#ChidresTechTutorials #JavaScript #JavaScriptTutorial
Комментарии