Tutorial - 8
• ECMAScript
• ES-6 vs ES-5
• ES-6 (modules & default parameters)
• Type conversion
• JS window object
• Web page crawler
• Element selector in JS
• DOM manipulation via API calls
• OOPs in JS
• Set, Weakset, Map & Symbol
• JS-Engine
• Recursion in JS
• Constructors in JS
• JS- decorators
• JS array with -ve index
(question)
ECMAScript
• ECMAScript is the general-purpose programming language which
is standardized by ECMA International following ECMA-262
document
• ECMAScript is different from JavaScript:
⚬ https://stackoverflow.com/questions/912479/what-is-the-
difference-between-javascript-and-ecmascript
• JavaScript is older then ECMAScript
• ECMAScript is the standard of language and JS is the language
• https://stackoverflow.com/questions/912479/what-is-the-difference-
between-javascript-and-ecmascript
• https://www.freecodecamp.org/news/whats-the-difference-between-
javascript-and-ecmascript-cba48c73a2b5/
ES-5 vs ES-6
• https://engineering.carsguide.com.au/es5-vs-es6-syntax-6c8350fa6998
• https://www.javatpoint.com/es5-vs-es6
• https://morioh.com/p/0236f0adaa4a (POINT-4)
• https://frontend.turing.edu/lessons/module-2/es5-vs-es6.html
web page crawler
• A Web crawler, sometimes called a spider or spiderbot
and often shortened to crawler, is an Internet bot that
systematically browses the World Wide Web, typically
operated by search engines for the purpose of Web
indexing (web spidering)
• When crawlers find a webpage, our systems render the
content of the page, just as a browser does. We take note
of key signals
Web crawler working model
Minor our own cralwer
Element selector
https://javascript.info/searching-elements-dom
OOPs in JavaSctipt
• OOPs or Object Oriented Programming is practice of a concept to have your code in
the form of objects which have either attributes or functions
• Major properties in JS are :
⚬ Abstraction,
⚬ Encapsulation,
⚬ Polymorphism
⚬ Inheritance
• Is JavaScript OOPs language:
⚬ Yes it is but its different from other OOPs language
⚬ It is prototype based object oriented language, which means it doesn’t have
classes rather it define behaviors using constructor function and then reuse
it using the prototype.
• https://www.geeksforgeeks.org/introduction-object-oriented-programming-javascript/
Set, WeakSet, Map & Symbol
• Set is elements with unique set of values i.e. there will be no repetition of
any value
Examples
Create unique elements in an array
• Note:
⚬ Only iterrable data-types like arrays are only allowed in Set
⚬ Hence objects cant be added to Set
WeakSet
• WeakSet let you add only object, Array of object
• It doesnt allow adding of premitive types & array of primitive types
• WeakSet allows Iterable data types but weakset itself is not an iterable henceit
cant be run by any loop
1 & 3
Map
• Map gives us the flexibility to accomplish the storage of any value in with the
clear information of key and value
• When we have an object why we need the Map then:
• Reason is:
⚬ Because if an object is having a key as an object then it can accept that
key only with one value depth whereas thats not so with Map
output when an object is considered instead
Map
Note: here only line 9 is present in
O/P
Note: here both assignment of value i.e. line 10 & 11 are present
Symbols
• https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/Symbol
• https://flaviocopes.com/javascript-symbols/
• https://javascript.info/symbol
• Symbol doesn't use new keyword for its declaration
• Symbol is inerrable
• Symbol is also a primitive data-type in JS
• It’s a very peculiar data type. Once you create a symbol, its value is kept
private and for internal use.
• object property keys may be either of string type, or of symbol type. Not
numbers, not booleans, only strings or symbols, these two types
JS- Engine
JavaScript at runtime
environment
• A JavaScript engine is a computer program that executes
JavaScript code. The first JavaScript engines were mere
interpreters, but all relevant modern engines use just-in-time
compilation for improved performance.
• Some famous JS engines are:
⚬ Google , Chrome, Node, Deno - V8
⚬ Mozila Firfox - SpiderMonkey
⚬ Microsoft Edge- Chakra
• Oldest one is Spider money by Brenden Eich (Inventer of JS)
when he was with Netscape
• JS engine is not a hardware but a code snippet only
• Steps followed by JS engine are:
⚬ Step-1 (Parsing)
■ Here our code is get converted to AST i.e. Abstract Syntax
Tree, which is the passed into the interpreter & after applying
algorithms like Mark & Sweep to remove unused code, we
then pass that code snippet to 2nd Step
⚬ Step-2 (Compilation)
■ Here compilation of code takes place which is then passed for
last sept
⚬ Step-3 (Execution)
■ Here in the last step Execution takes place which is performed
on completely optimized code
Web development basics (Part-7)

Web development basics (Part-7)

  • 1.
    Tutorial - 8 •ECMAScript • ES-6 vs ES-5 • ES-6 (modules & default parameters) • Type conversion • JS window object • Web page crawler • Element selector in JS • DOM manipulation via API calls • OOPs in JS • Set, Weakset, Map & Symbol • JS-Engine • Recursion in JS • Constructors in JS • JS- decorators • JS array with -ve index (question)
  • 2.
    ECMAScript • ECMAScript isthe general-purpose programming language which is standardized by ECMA International following ECMA-262 document • ECMAScript is different from JavaScript: ⚬ https://stackoverflow.com/questions/912479/what-is-the- difference-between-javascript-and-ecmascript • JavaScript is older then ECMAScript • ECMAScript is the standard of language and JS is the language • https://stackoverflow.com/questions/912479/what-is-the-difference- between-javascript-and-ecmascript • https://www.freecodecamp.org/news/whats-the-difference-between- javascript-and-ecmascript-cba48c73a2b5/
  • 3.
    ES-5 vs ES-6 •https://engineering.carsguide.com.au/es5-vs-es6-syntax-6c8350fa6998 • https://www.javatpoint.com/es5-vs-es6 • https://morioh.com/p/0236f0adaa4a (POINT-4) • https://frontend.turing.edu/lessons/module-2/es5-vs-es6.html
  • 4.
    web page crawler •A Web crawler, sometimes called a spider or spiderbot and often shortened to crawler, is an Internet bot that systematically browses the World Wide Web, typically operated by search engines for the purpose of Web indexing (web spidering) • When crawlers find a webpage, our systems render the content of the page, just as a browser does. We take note of key signals
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
    OOPs in JavaSctipt •OOPs or Object Oriented Programming is practice of a concept to have your code in the form of objects which have either attributes or functions • Major properties in JS are : ⚬ Abstraction, ⚬ Encapsulation, ⚬ Polymorphism ⚬ Inheritance • Is JavaScript OOPs language: ⚬ Yes it is but its different from other OOPs language ⚬ It is prototype based object oriented language, which means it doesn’t have classes rather it define behaviors using constructor function and then reuse it using the prototype. • https://www.geeksforgeeks.org/introduction-object-oriented-programming-javascript/
  • 10.
    Set, WeakSet, Map& Symbol • Set is elements with unique set of values i.e. there will be no repetition of any value
  • 11.
  • 12.
    Create unique elementsin an array • Note: ⚬ Only iterrable data-types like arrays are only allowed in Set ⚬ Hence objects cant be added to Set
  • 13.
    WeakSet • WeakSet letyou add only object, Array of object • It doesnt allow adding of premitive types & array of primitive types • WeakSet allows Iterable data types but weakset itself is not an iterable henceit cant be run by any loop 1 & 3
  • 14.
    Map • Map givesus the flexibility to accomplish the storage of any value in with the clear information of key and value • When we have an object why we need the Map then: • Reason is: ⚬ Because if an object is having a key as an object then it can accept that key only with one value depth whereas thats not so with Map output when an object is considered instead Map Note: here only line 9 is present in O/P
  • 15.
    Note: here bothassignment of value i.e. line 10 & 11 are present
  • 16.
    Symbols • https://developer.mozilla.org/en- US/docs/Web/JavaScript/Reference/Global_Objects/Symbol • https://flaviocopes.com/javascript-symbols/ •https://javascript.info/symbol • Symbol doesn't use new keyword for its declaration • Symbol is inerrable • Symbol is also a primitive data-type in JS • It’s a very peculiar data type. Once you create a symbol, its value is kept private and for internal use. • object property keys may be either of string type, or of symbol type. Not numbers, not booleans, only strings or symbols, these two types
  • 17.
  • 18.
  • 19.
    • A JavaScriptengine is a computer program that executes JavaScript code. The first JavaScript engines were mere interpreters, but all relevant modern engines use just-in-time compilation for improved performance. • Some famous JS engines are: ⚬ Google , Chrome, Node, Deno - V8 ⚬ Mozila Firfox - SpiderMonkey ⚬ Microsoft Edge- Chakra • Oldest one is Spider money by Brenden Eich (Inventer of JS) when he was with Netscape • JS engine is not a hardware but a code snippet only
  • 20.
    • Steps followedby JS engine are: ⚬ Step-1 (Parsing) ■ Here our code is get converted to AST i.e. Abstract Syntax Tree, which is the passed into the interpreter & after applying algorithms like Mark & Sweep to remove unused code, we then pass that code snippet to 2nd Step ⚬ Step-2 (Compilation) ■ Here compilation of code takes place which is then passed for last sept ⚬ Step-3 (Execution) ■ Here in the last step Execution takes place which is performed on completely optimized code