0% found this document useful (0 votes)
67 views14 pages

Mobile Application Development

This document provides an introduction to JavaScript including: - JavaScript is an interpreted language with each browser implementing its own engine to interpret code. - It covers JavaScript syntax including variables, data types like numbers and strings, and scoping rules. - Objects are also introduced including how to create, add properties and methods to objects using functions. - Array functions like filter and map are demonstrated to transform arrays.

Uploaded by

Syed Aqib Raza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views14 pages

Mobile Application Development

This document provides an introduction to JavaScript including: - JavaScript is an interpreted language with each browser implementing its own engine to interpret code. - It covers JavaScript syntax including variables, data types like numbers and strings, and scoping rules. - Objects are also introduced including how to create, add properties and methods to objects using functions. - Array functions like filter and map are demonstrated to transform arrays.

Uploaded by

Syed Aqib Raza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Mobile Application Development

Introduction to JavaScript
Interpreted Language
• Each browser has its own JavaScript engine, which either interprets
the code, or uses some sort of lazy compilation
• V8: Chrome and Node.js
• SpiderMonkey: Firefox
• JavaScriptCore: Safari
• Chakra: Microsoft Edge/IE

• They each implement the ECMAScript standard, but may differ for
anything not defined by the standard
Syntax
• Declarations
• Var
• Let
• Const
• Variables
• Same as most other languages
• Declaring variables
• Global and local scope
• Literals
Datatypes
• Dynamic typing
• Primitive types
• undefined
• null
• boolean
• number
• string
• symbol
• Objects
Typecasting? Coercion.
• Explicit vs. Implicit Coercion

• == vs ===
Primitives Vs. Objects
• Primitives are immutable
• Objects are mutable and stored by reference
• Passing by reference vs. passing by value
Scoping
• Lexical
• Block
Array Functions
• Filter
• The filter() method creates a new array with all elements that pass the test
implemented by the provided function
const words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
const result = words.filter(word => word.length > 6);
• Map
• The map() method creates a new array populated with the results of calling a
provided function on every element in the calling array.
const array1 = [1, 4, 9, 16
map1 = array1.map(x => x * 2);
Objects
• An object is a collection of properties, and a property is an association
between a name (or key) and a value.
• Creation
Objects
• Constructor
• Define the object type by writing a constructor function. use a capital initial
letter(convention).
• Create an instance of the object with new.
Objects
• Use of this
•  use within a method to refer to
the current object.
Objects
• Deleting properties
•   can remove a non-inherited property
Objects
• Comparing objects
•  objects are a reference type.
• distinct objects are never equal, even if they have the same properties.
• Only comparing the same object reference with itself yields true.

You might also like