JavaScript Execution Phases, Global Context, and Pitfalls

this greet how hello who beer js n.w
1 / 20
Embed
Share

Explore the intricate phases of JavaScript execution, from global context setup to potential pitfalls. Delve into the nuances of NaN, IEEE 754, and type conversions. Discover the ABCs of the GEC and get insights from a seasoned Full Stack Developer on navigating the JavaScript landscape.

  • JavaScript
  • Execution
  • Global Context
  • NaN
  • Type Conversion

Uploaded on | 1 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. this.greet(how: Hello, who: Beer.JS)

  2. typeof NaN === number parseInt(0.00000005) === 5 var self = this Math.min() > Math.max()

  3. /** Pit of Despair **/ typeof NaN === number parseInt(0.00000005) === 5 Math.min() > Math.max() var self = this

  4. - IEEE 754 - Type Conversion - Search Algo. Artifact - GEC

  5. Context Matters The ABC s of the GEC

  6. noa@beerjs:$ whoami Teodor Simonovski Full Stack Developer and Tech-Lead @ Sourcico 99% of career spent working with JS Like JS, Love TS

  7. /* * Any application that can be written in JavaScript, * will eventually be written in JavaScript */ Jeff Atwood (2007)

  8. var self = this

  9. <script src=./index.js>

  10. Global Execution Context 1. Create global object window (browsers) global (Node) 2. Create this keyword this = window (browser) 3. Create scope chain . . . [GEC]

  11. Creation Phase window = { var firstName = Cave var lastName = Johnson fullName: function( ) fullName(firstName, lastName) firstName: undefined lastName: undefined function fullName(firstName, lastName) { return `${firstName} ${lastName}` } }

  12. Execution Phase window = { var firstName = Cave var lastName = Johnson fullName: function( ) fullName(firstName, lastName) firstName: undefined firstName: Cave lastName: Johnson lastName: undefined function fullName(firstName, lastName) { return `${firstName} ${lastName}` } }

  13. Hoisting var firstName = Cave var lastName = Johnson fullName(firstName, lastName) function fullName(firstName, lastName) { return makeUpperCase(`${firstName} ${lastName}`) } var makeUpperCase = function(string) { return string.toUpperCase() }

  14. Execution Phase window = { var firstName = Cave var lastName = Johnson fullName: function( ) fullName(firstName, lastName) firstName: Cave lastName: Johnson function fullName(firstName, lastName) { return `${firstName} ${lastName}` } }

  15. Functional Execution Context 1. Create arguments object Zero-Indexed keys length property 2. Create this keyword this = ? 3. Create scope chain [fullName, GEC]

  16. What is this? In a function call, the global object** *in the browser, depends on strict mode **in Node, depends on the type In a method, the object In an event, the element

  17. Bind, Call, Apply .bind(this) Generates a new function with a new this .call(this, ) / .apply(this,[, ]) Immediately calls the function, binding it with this from the argument call accepts x amount of arguments, apply accepts an array of arguments

  18. => Functions let, const { { Block Scoped, const is constant, No more hoisting } Get hoisted, But can t access them Only as expressions No this No arguments object ES6 }

  19. this.greet(how: Bye, who: Beer.JS)

Related


More Related Content