Page 144 - CITS - Computer Software Application -TT
P. 144
COMPUTER SOFTWARE APPLICATION - CITS
• JavaScript | uneval()
• JavaScript | parseInt()
• JavaScript | match()
• JavaScript | Date.parse()
• JavaScript | Replace() Method
• JavaScript | Map.get( )
• JavaScript | Map.entries( )
• JavaScript | Map.clear( )
• JavaScript | Map.delete()
• JavaScript | Map.has( )
Concept of Object oriented Development
In JavaScript, object-oriented development is based on a prototype-based model rather than a class-based
model, as seen in languages like Java. Here are the key concepts of object-oriented development in JavaScript:
1 Objects and Properties:
• In JavaScript, objects are collections of key-value pairs where keys are strings (or Symbols) and values can
be of any data type.
• Properties of an object can hold data or functions (methods).
var person = {
firstName: “John”,
lastName: “Doe”,
getFullName: function() {
return this.firstName + “ “ + this.lastName;
}
};
2 Prototypes and Inheritance:
• Every object in JavaScript has a prototype, which is another object. If a property or method is not found on
the object itself, JavaScript looks for it in the object’s prototype, forming a prototype chain.
• Objects can inherit properties and methods from their prototypes.
var student = Object.create(person); // ‘student’ inherits from ‘person’
student.school = “XYZ School”;
3 Constructor Functions:
• While JavaScript doesn’t have classes in the traditional sense, constructor functions can be used to create
objects with shared properties and methods.
• The new keyword is used to instantiate objects from constructor functions.
function Person(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
Person.prototype.getFullName = function() {
131
CITS : IT&ITES - Computer Software Application - Lesson 37 - 46