answersLogoWhite

0


Best Answer

Properties in JavaScript van be thought of as a variable inside of an Object.

While:

var foo = 'bar';

is a variable.

Here:

var foo = {bar:'baz'};

bar is a property of the foo object.

You van also assign properties to an object in an array/hash-map like way, using square braces like follows:

foo['qux'] = 'spam';

The main difference here is the use of quotes to delimit the property name. Note also that in the current JavaScript version (ES 3) you cannot use reserved words (i.e. for, in function, brake or etc.) as property names without delimiting the names with quotes (' or ").

Properties can also hold functions, and when the do they are called methods (of the object).

Mainly properties are used either as normal variables, just within the namespace of the enclosing object. Or they are used as indexes when using objects like associative arrays/hash-maps/dictionaries/word-list/array-lists. It is btw. discouraged to use javascript arrays non-numeric indexes, since such arrays wil be treated much like objects, normal objects should be used.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

Properties in JavaScript van be thought of as a variable inside of an Object.

While:

var foo = 'bar';

is a variable.

Here:

var foo = {bar:'baz'};

bar is a property of the foo object.

You van also assign properties to an object in an array/hash-map like way, using square braces like follows:

foo['qux'] = 'spam';

The main difference here is the use of quotes to delimit the property name. Note also that in the current JavaScript version (ES 3) you cannot use reserved words (i.e. for, in function, brake or etc.) as property names without delimiting the names with quotes (' or ").

Properties can also hold functions, and when the do they are called methods (of the object).

Mainly properties are used either as normal variables, just within the namespace of the enclosing object. Or they are used as indexes when using objects like associative arrays/hash-maps/dictionaries/word-list/array-lists. It is btw. discouraged to use javascript arrays non-numeric indexes, since such arrays wil be treated much like objects, normal objects should be used.

From: What_is_JavaScript_properties

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are Properties and Methods in object oriented programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are the primary methods of programming?

The two primary methods of programming are procedural and object-oriented.


Why is object-oriented programming advantageous over other techniques?

advantages of object oriented programming over other techniques 1. Reusability of code 2. Easy to access class properties, methods through object 3. Runtime processing based on input values


What three concepts are the basis for object-oriented programming?

Classes, objects and methods are the three concepts for OOP programming.


What is a java object?

A java object is a collection of methods and properties defined in the Java programming language.


Thw importance of ASP.net?

Object Oriented Programming is a subset of structured programming. After objects are created in a program, you use those objects and their methods to operate the program. In structured programming, you have a program with many methods in which you can use. One difference between structured programming and object-oriented programming is that structured programming uses the data that is given to them through parameters, while in object-oriented programming, the methods act upon the object's data (fields). This makes programming much easier because the fields are all there and you do not have to make sure that the correct field is passed to the correct method. All you have to do is call which field you want to work with.


What is full form of oop's?

Object Oriented Programming


What does oop stand for?

OOP (Object Oriented Programming) is the implementation phase of OOD. OOD (Object Oriented Design) is a philosophy that considers things as objects that have attributes and methods. There can be public attributes and methods, and there can be private attributes and methods. The public interface is used to design the relationship between the object and its users, while the private interface is used to design the implementation of how that object works. If done correctly, the private implementation can be changed without requiring any change to the public interface or to its users. Often, a new object can be defined as a derivation of some other object, such as an officer is an employee. The derivation would add the necessary public and private aspects of an officer while inheriting the prior implementation of the public and private aspects of an employee.


What is the need for c plus plus?

Primarily to add object oriented programming methods to the C language.


Is PHP object oriented?

Yes - 'advanced' PHP programming uses Object Oriented Programming (OOP).


What is an essential of Object Oriented Programming?

The 3 essential concepts of Object Oriented Programming are:InheritanceEncapsulation &Polymorphism


What is the distinct difference between object oriented concept and object oriented programming?

Object oriented concepts are a generalisation of the object oriented principals (encapsulation, inheritance, polymorphism and abstraction) without specifying a particular implementation of those principals. Object oriented programming is the application of those principals through an object oriented programming language.


What is an object in c?

C does not contain any built in constructs for object oriented programming. Methods and Data are generally not stored in an object structure in c.