SlideShare una empresa de Scribd logo
1 de 17
WEB TECHNOLOGY
TEAM NAME:WEB HOST
TEAM MEMBERS:BHAVANA G
BINDHUSHREE R
NEELIMA REDDY
LIKITHASHREE
JAVASCRIPT OBJECTS AND CONSTRUCTORS
OBJECTS IN JAVASCRIPT
Objects, in JavaScript, is the most important data-type and forms the
building blocks for modern JavaScript. These objects are quite different from
JavaScript’s primitive data types (Number, String, Boolean, null, undefined
and symbol) in the sense that while these primitive data-types all store a
single value each (depending on their types).
Syntax:
let object_name = {
key_name : value,
...
}
Let us look at an example of a JavaScript Object
below :
<script>
// JavaScript code demonstrating a simple object
let school = {
name: 'Vivekananda School',
location : 'Delhi',
established : '1971',
displayInfo : function(){
console.log(`${school.name} was established
in ${school.established} at ${school.location}`);
}
}
school.displayInfo();
</script>
OUTPUT:Vivekananda School was established.
In this example “name”, “location”, “established” are
all “keys” and “Vivekananda School”, “Delhi” and
1971 are values of these keys respectively. Each of these
keys is referred to as properties of the object. An object in
JavaScript may also have a function as a member, in which
case it will be known as a method of that object.
Here “displayinfo” is a method of the school object that is
being used to work with the object’s data, stored in its
properties.
• Objects are more complex and each object may contain any
combination of these primitive data-types as well as reference
data-types.
• An object is a reference data type. Variables that are assigned a
reference value are given a reference or a pointer to that value.
That reference or pointer points to the location in memory
where the object is stored. The variables don’t actually store the
value.
• Loosely speaking, objects in JavaScript may be defined as
an unordered collection of related data, of primitive or
reference types, in the form of “key: value” pairs. These
keys can be variables or functions and are called properties and
methods, respectively, in the context of an objec
Properties of JavaScript Object
• The property names can be strings or numbers. In case the property names are numbers,
they must be accessed using the “bracket notation” like this :
<script>
let school = {
name: 'Vivekananda School',
location : 'Delhi',
established : '1971',
20 : 1000,
displayInfo : function(){
console.log(`The value of the key 20 is ${school['20']}`);
}
}
school.displayInfo();
</script>
OUTPUT:The value of the key 20 is 1000.
•But more on the bracket notation later. Property names
can also be strings with more than one space separated
words. In which case, these property names must be
enclosed in quotes :
let school = {
"school name" : "Vivekananda School",
}
CREATING OBJECTS
• There are several ways or syntax’s to create objects. One of which, known as
the Object literal syntax, we have already used. Besides the object literal syntax,
objects in JavaScript may also be created using the constructors, Object
Constructor, or the prototype pattern.
• Using the Object literal syntax : Object literal syntax uses the {…} notation to
initialize an object an its methods/properties directly. Let us look at an example
of creating objects using this method :
• var obj = {
• member1 : value1,
• member2 : value2,
• };
OBJECTS INCLUDED IN JAVASCRIPT
A Number of useful objects are included with JavaScript including:
Array
Boolean
Date
Math
String
Dom objects
Arrays
Arrays are one of the most used data structures.in practise,this class is
defined to behave more like a linked list in that it can be resized
The following code creates a new,empty array named
greetings:
Var greetings=new Array();
To initialize the array with values,the variable declaration would look like
the following:
Var greetings=new Array(“Good Morning”,”Good Afternoon”);
DOCUMENT OBJECT
• The DOM document object is the root JavaScript object representing
the entire HTML document.
• It contains some properties and methods that we will use extensively
in our development and is globally accessible as document.
//specify the doctype,for example html
var a=document.doctype.name;
//specify the page encoding,for example ISO-8859-1
var b=document.inputEncoding;
JAVASCRIPT BOOLEANS
• A JavaScript Boolean represents one of two values:
true or false.
THE BOOLEAN()FUNCTION
You can use the Boolean() function to find out if an expression(or a
variable)is true:
EXAMPLE:
Boolean(10 > 9)
JAVASCRIPT DATA OBJECT
• The JavaScript date object can be used to get year,month and day .you can
display a timer on the webpage by the help of JavaScript date object.
• SYNTAX
You can use any of the following syntaxes to create a Date objects using Date()
constructor.
new Date()
new Date(milliseconds)
new Date(datestring)
NOTE:Parameters in the brackets are always optional.
JAVASCRIPT MATH OBJECT
• The JavaScript Math object allows you to perform mathematical tasks
on numbers.
• EXAMPLE
Math.E // returns Euler’s
number
CONSTRUCTORS
• Normally to create a new object we use the new keyword, the class
name, and()brackets with n optional parameters inside, comma
delimited as follows:
var someObject = new ObjectName(p1,p2,….., pn)
; for some classes, shortcut constructors are
defined var greeting=“Good Morning”;
Vs the formal:
Var greeting = new String(“Good Morning”);
<script>
function Vehicle(name, maker) {
this.name = name;
this.maker = maker;
}
let car1 = new Vehicle('Fiesta', 'Ford');
let car2 = new Vehicle('Santa Fe', 'Hyundai’)
console.log(car1.name); // Output:
Fiesta
console.log(car2.name); // Output:
Santa Fe
</script>
THANK YOU

Más contenido relacionado

Similar a Web Host_G4.pptx

JavaScript Workshop
JavaScript WorkshopJavaScript Workshop
JavaScript WorkshopPamela Fox
 
Ajax and JavaScript Bootcamp
Ajax and JavaScript BootcampAjax and JavaScript Bootcamp
Ajax and JavaScript BootcampAndreCharland
 
Cordova training : Day 4 - Advanced Javascript
Cordova training : Day 4 - Advanced JavascriptCordova training : Day 4 - Advanced Javascript
Cordova training : Day 4 - Advanced JavascriptBinu Paul
 
javascript
javascript javascript
javascript Kaya Ota
 
Javascriptinobject orientedway-090512225827-phpapp02
Javascriptinobject orientedway-090512225827-phpapp02Javascriptinobject orientedway-090512225827-phpapp02
Javascriptinobject orientedway-090512225827-phpapp02Sopheak Sem
 
AJS UNIT-1 2021-converted.pdf
AJS UNIT-1 2021-converted.pdfAJS UNIT-1 2021-converted.pdf
AJS UNIT-1 2021-converted.pdfSreeVani74
 
Synapseindia object oriented programming in php
Synapseindia object oriented programming in phpSynapseindia object oriented programming in php
Synapseindia object oriented programming in phpSynapseindiappsdevelopment
 
Drupal 7 entities & TextbookMadness.com
Drupal 7 entities & TextbookMadness.comDrupal 7 entities & TextbookMadness.com
Drupal 7 entities & TextbookMadness.comJD Leonard
 
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPTHSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPTAAFREEN SHAIKH
 
11. session 11 functions and objects
11. session 11   functions and objects11. session 11   functions and objects
11. session 11 functions and objectsPhúc Đỗ
 
Local storage in Web apps
Local storage in Web appsLocal storage in Web apps
Local storage in Web appsIvano Malavolta
 
Javascript Templating
Javascript TemplatingJavascript Templating
Javascript Templatingbcruhl
 
Local data storage for mobile apps
Local data storage for mobile appsLocal data storage for mobile apps
Local data storage for mobile appsIvano Malavolta
 

Similar a Web Host_G4.pptx (20)

11-Classes.ppt
11-Classes.ppt11-Classes.ppt
11-Classes.ppt
 
JavaScript Workshop
JavaScript WorkshopJavaScript Workshop
JavaScript Workshop
 
Week3
Week3Week3
Week3
 
chap04.ppt
chap04.pptchap04.ppt
chap04.ppt
 
JavaScript Lessons 2023 V2
JavaScript Lessons 2023 V2JavaScript Lessons 2023 V2
JavaScript Lessons 2023 V2
 
Ajax and JavaScript Bootcamp
Ajax and JavaScript BootcampAjax and JavaScript Bootcamp
Ajax and JavaScript Bootcamp
 
Cordova training : Day 4 - Advanced Javascript
Cordova training : Day 4 - Advanced JavascriptCordova training : Day 4 - Advanced Javascript
Cordova training : Day 4 - Advanced Javascript
 
javascript
javascript javascript
javascript
 
Javascriptinobject orientedway-090512225827-phpapp02
Javascriptinobject orientedway-090512225827-phpapp02Javascriptinobject orientedway-090512225827-phpapp02
Javascriptinobject orientedway-090512225827-phpapp02
 
Java Script Best Practices
Java Script Best PracticesJava Script Best Practices
Java Script Best Practices
 
AJS UNIT-1 2021-converted.pdf
AJS UNIT-1 2021-converted.pdfAJS UNIT-1 2021-converted.pdf
AJS UNIT-1 2021-converted.pdf
 
Synapseindia object oriented programming in php
Synapseindia object oriented programming in phpSynapseindia object oriented programming in php
Synapseindia object oriented programming in php
 
Drupal 7 entities & TextbookMadness.com
Drupal 7 entities & TextbookMadness.comDrupal 7 entities & TextbookMadness.com
Drupal 7 entities & TextbookMadness.com
 
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPTHSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
 
11. session 11 functions and objects
11. session 11   functions and objects11. session 11   functions and objects
11. session 11 functions and objects
 
Local storage in Web apps
Local storage in Web appsLocal storage in Web apps
Local storage in Web apps
 
02 objective-c session 2
02  objective-c session 202  objective-c session 2
02 objective-c session 2
 
Javascript Templating
Javascript TemplatingJavascript Templating
Javascript Templating
 
Local data storage for mobile apps
Local data storage for mobile appsLocal data storage for mobile apps
Local data storage for mobile apps
 
Javascript
JavascriptJavascript
Javascript
 

Último

Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxPurva Nikam
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniquesugginaramesh
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 

Último (20)

Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptx
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniques
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 

Web Host_G4.pptx

  • 1. WEB TECHNOLOGY TEAM NAME:WEB HOST TEAM MEMBERS:BHAVANA G BINDHUSHREE R NEELIMA REDDY LIKITHASHREE
  • 2. JAVASCRIPT OBJECTS AND CONSTRUCTORS OBJECTS IN JAVASCRIPT Objects, in JavaScript, is the most important data-type and forms the building blocks for modern JavaScript. These objects are quite different from JavaScript’s primitive data types (Number, String, Boolean, null, undefined and symbol) in the sense that while these primitive data-types all store a single value each (depending on their types). Syntax: let object_name = { key_name : value, ... }
  • 3. Let us look at an example of a JavaScript Object below : <script> // JavaScript code demonstrating a simple object let school = { name: 'Vivekananda School', location : 'Delhi', established : '1971', displayInfo : function(){ console.log(`${school.name} was established in ${school.established} at ${school.location}`); } } school.displayInfo(); </script> OUTPUT:Vivekananda School was established.
  • 4. In this example “name”, “location”, “established” are all “keys” and “Vivekananda School”, “Delhi” and 1971 are values of these keys respectively. Each of these keys is referred to as properties of the object. An object in JavaScript may also have a function as a member, in which case it will be known as a method of that object. Here “displayinfo” is a method of the school object that is being used to work with the object’s data, stored in its properties.
  • 5. • Objects are more complex and each object may contain any combination of these primitive data-types as well as reference data-types. • An object is a reference data type. Variables that are assigned a reference value are given a reference or a pointer to that value. That reference or pointer points to the location in memory where the object is stored. The variables don’t actually store the value. • Loosely speaking, objects in JavaScript may be defined as an unordered collection of related data, of primitive or reference types, in the form of “key: value” pairs. These keys can be variables or functions and are called properties and methods, respectively, in the context of an objec
  • 6. Properties of JavaScript Object • The property names can be strings or numbers. In case the property names are numbers, they must be accessed using the “bracket notation” like this : <script> let school = { name: 'Vivekananda School', location : 'Delhi', established : '1971', 20 : 1000, displayInfo : function(){ console.log(`The value of the key 20 is ${school['20']}`); } } school.displayInfo(); </script> OUTPUT:The value of the key 20 is 1000.
  • 7. •But more on the bracket notation later. Property names can also be strings with more than one space separated words. In which case, these property names must be enclosed in quotes : let school = { "school name" : "Vivekananda School", }
  • 8. CREATING OBJECTS • There are several ways or syntax’s to create objects. One of which, known as the Object literal syntax, we have already used. Besides the object literal syntax, objects in JavaScript may also be created using the constructors, Object Constructor, or the prototype pattern. • Using the Object literal syntax : Object literal syntax uses the {…} notation to initialize an object an its methods/properties directly. Let us look at an example of creating objects using this method : • var obj = { • member1 : value1, • member2 : value2, • };
  • 9. OBJECTS INCLUDED IN JAVASCRIPT A Number of useful objects are included with JavaScript including: Array Boolean Date Math String Dom objects
  • 10. Arrays Arrays are one of the most used data structures.in practise,this class is defined to behave more like a linked list in that it can be resized The following code creates a new,empty array named greetings: Var greetings=new Array(); To initialize the array with values,the variable declaration would look like the following: Var greetings=new Array(“Good Morning”,”Good Afternoon”);
  • 11. DOCUMENT OBJECT • The DOM document object is the root JavaScript object representing the entire HTML document. • It contains some properties and methods that we will use extensively in our development and is globally accessible as document. //specify the doctype,for example html var a=document.doctype.name; //specify the page encoding,for example ISO-8859-1 var b=document.inputEncoding;
  • 12. JAVASCRIPT BOOLEANS • A JavaScript Boolean represents one of two values: true or false. THE BOOLEAN()FUNCTION You can use the Boolean() function to find out if an expression(or a variable)is true: EXAMPLE: Boolean(10 > 9)
  • 13. JAVASCRIPT DATA OBJECT • The JavaScript date object can be used to get year,month and day .you can display a timer on the webpage by the help of JavaScript date object. • SYNTAX You can use any of the following syntaxes to create a Date objects using Date() constructor. new Date() new Date(milliseconds) new Date(datestring) NOTE:Parameters in the brackets are always optional.
  • 14. JAVASCRIPT MATH OBJECT • The JavaScript Math object allows you to perform mathematical tasks on numbers. • EXAMPLE Math.E // returns Euler’s number
  • 15. CONSTRUCTORS • Normally to create a new object we use the new keyword, the class name, and()brackets with n optional parameters inside, comma delimited as follows: var someObject = new ObjectName(p1,p2,….., pn) ; for some classes, shortcut constructors are defined var greeting=“Good Morning”; Vs the formal: Var greeting = new String(“Good Morning”);
  • 16. <script> function Vehicle(name, maker) { this.name = name; this.maker = maker; } let car1 = new Vehicle('Fiesta', 'Ford'); let car2 = new Vehicle('Santa Fe', 'Hyundai’) console.log(car1.name); // Output: Fiesta console.log(car2.name); // Output: Santa Fe </script>