SlideShare a Scribd company logo
Effective JavaScript
Effective JavaScript
          Justin Tulloss
     Sr. Software Engineer
         April 24, 2010
Overview

• JavaScript language properties
• Effective closures
• Effective objects
• Interacting with the DOM
• ECMAScript 5
• v8 optimizations
Prototypes
Assigning to a Prototype
Altering a Prototype
Altering a Prototype Faster
Deriving an Object from Another
Object
Deriving an Object with
Object.create
Scope Resolution
What Is in the Resolution Chain?
Functions dictate scope (with a few exceptions)



• Local variables
• Arguments
• Enclosing function scopes
• With Statement
• Global
Each Step Is Like a Property Access




locals.arguments.scope1Locals.scope1Args.globals
Example
Don’t Use with
Effective Closures
The Power of Closures
With great power comes great responsibility



• Reduce typing
• Make code cleaner
• Provide some privacy
• Sometimes they make things fast
• Magic (AKA functional)
Building Objects with Closures
Same Thing Works for Constructors
Avoiding bind in Asynchronous
Operations
Avoiding Unnecessary Methods
Memoization
Effective Objects
Using Objects Effectively

• First, do what makes sense—don’t over-optimize
• Every property access is slow
• Breadth not depth
• Use object literals
• Make shortcuts
• Inspectable
Use Object Literals


 Bad




 Good
Interacting with
    the DOM
Don’t
DOM Tips

• Watch out for closures referencing nodes
  • These can leak
• Reference nodes anyway
  • Using a reference is much faster than looking up a node
• innerHTML is generally faster than the DOM API
ECMAScript 5
Exciting New Features

• Function.prototype.bind
• Object.create
• Getters/setters
• String.prototype.trim
Getters and Setters
v8 Optimizations
v8 Optimizations

• Don’t use delete
• Use object literals
• Avoid altering objects after creating them
• Don’t use eval
If it’s hard in C,
    it’s slow in
Q &A
Effective JavaScript
Ad

More Related Content

What's hot (10)

Intro to TypeScript, HTML5DevConf Oct 2013 by Matt Harrington, has 11 slides with 551 views.TypeScript is a typed superset of JavaScript that compiles to plain JavaScript and allows for large-scale application development. It adds features like classes, modules, interfaces, and optional static typing to JavaScript. TypeScript compiles to plain JavaScript, so it can be used anywhere JavaScript runs in browsers, hosts, and operating systems. It supports using existing JavaScript and third-party libraries while also providing benefits like cleaner code and catching errors for Angular, jQuery, and library developers working on larger applications.
Intro to TypeScript, HTML5DevConf Oct 2013Intro to TypeScript, HTML5DevConf Oct 2013
Intro to TypeScript, HTML5DevConf Oct 2013
Matt Harrington
11 slides551 views
Php : Why and When! by Nishant Shrivastava, has 14 slides with 346 views.This document discusses why PHP is a good choice for web development. It notes that PHP is open source and free, has simple documentation, an active community, many libraries, and low infrastructure costs. Specific benefits highlighted include easy documentation, helpful community support, good package and library options through PECL and Composer, and low costs. While other open source languages exist, the document argues PHP has advantages in scaling, development speed through tools like PHPStorm and xDebug, and maintainability.
Php : Why and When!Php : Why and When!
Php : Why and When!
Nishant Shrivastava
14 slides346 views
AWS Lambda Function with Kotlin by Troy Miles, has 37 slides with 1277 views.Kotlin is a language from the tool gurus at JetBrains. In 2016, after about six years of development, Kotlin reached version 1.0. In 2017 it won the hearts of developers and became an officially supported language for Android. Kotlin, like Java, is for more than creating Android applications. It can replace or enhance Java most places it is used today including on AWS. AWS Lambda functions sometimes called Serverless Computing, is a service which lets us developers build web services without worrying about configuring servers. In this session, we will create a lambda service on AWS using Kotlin. Along the way, we will learn what a makes Kotlin an excellent replacement for Java and how simple it is to construct an AWS Lambda function.
AWS Lambda Function with KotlinAWS Lambda Function with Kotlin
AWS Lambda Function with Kotlin
Troy Miles
37 slides1.3K views
Javantura v4 - Java or Scala – Web development with Playframework 2.5.x - Kre... by HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association, has 21 slides with 1047 views.This document compares Java and Scala for web development using the Playframework 2.5.x. It provides an overview of Scala and the Playframework, including how to set up a Play application with Scala. It demonstrates building a sample web application for a speaker database using Play and Scala, including setting up the project structure, models, database integration, JSON handling, testing, and deployment. The document aims to demonstrate how to develop a web application from start to finish using the Playframework and Scala.
Javantura v4 - Java or Scala – Web development with Playframework 2.5.x - Kre...Javantura v4 - Java or Scala – Web development with Playframework 2.5.x - Kre...
Javantura v4 - Java or Scala – Web development with Playframework 2.5.x - Kre...
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
21 slides1K views
Truly madly deeply parallel ruby applications by Hari Krishnan‎, has 53 slides with 477 views.The document discusses building truly parallel Ruby web applications using threads instead of processes to achieve scaling. It outlines some key considerations for moving to a threaded parallel model including identifying shared resources, using thread-safe libraries, sticking to Rails' request handling approach, and allowing time for stabilization. JRuby is presented as an option for threaded parallelism since it runs on the JVM, but it impacts developers through slower startup times and sometimes requiring Java knowledge, and impacts operations through its underlying Java nature.
Truly madly deeply parallel ruby applicationsTruly madly deeply parallel ruby applications
Truly madly deeply parallel ruby applications
Hari Krishnan‎
53 slides477 views
Beyond The Rails Way by Andrzej Krzywda, has 35 slides with 3539 views.The Rails Way is the reason of Rails success. It's also the reason of Rails disappointment. Why is it so? Is there any alternative?
Beyond The Rails WayBeyond The Rails Way
Beyond The Rails Way
Andrzej Krzywda
35 slides3.5K views
The Holy Grail of continuous delivery in distributed teams environment by Szymon Kurcab, has 14 slides with 118 views.A brief presentation on how to hit the goal of continuous delivery/deployment for Ruby (RoR) web applications
The Holy Grail of continuous delivery in distributed teams environmentThe Holy Grail of continuous delivery in distributed teams environment
The Holy Grail of continuous delivery in distributed teams environment
Szymon Kurcab
14 slides118 views
.Net Core 3.0. What’s inside? Павло Голубович by Sigma Software, has 18 slides with 57 views..NET Core 3 provides a cross-platform, high-performance, and more lightweight development framework compared to the .NET Framework. It supports Windows, Linux, and macOS. Key features include C# 8 language improvements, ASP.NET Core updates like Blazor, gRPC and performance optimizations of up to 6x for common operations like JSON processing. While migrating existing projects can be painful, .NET Core 3 offers benefits from .NET Standard 2.1 compatibility and an open source model. The future of .NET development will continue to focus on .NET Core as the main platform.
.Net Core 3.0. What’s inside? Павло Голубович.Net Core 3.0. What’s inside? Павло Голубович
.Net Core 3.0. What’s inside? Павло Голубович
Sigma Software
18 slides57 views
From Rails legacy to DDD - Pivorak, Lviv by Andrzej Krzywda, has 68 slides with 1696 views.Rails is optimised for the first weeks of development. At the later phases it's no longer the speed of adding new views and data that matters. It's often more about the different (and changing!) ways of using the data. The business logic gets more complicated. DDD has answers to those problems. Detecting the bounded contexts is the crucial skill. Choose which parts of the app leave as CRUD and which could go into more of the tactical DDD.
From Rails legacy to DDD - Pivorak, LvivFrom Rails legacy to DDD - Pivorak, Lviv
From Rails legacy to DDD - Pivorak, Lviv
Andrzej Krzywda
68 slides1.7K views
MySQL-Mixer-Livenation by Hari Tatrakal, has 12 slides with 536 views.The document discusses various database backup methods and their advantages and disadvantages. It provides details on backup and restore times for different methods like mysqldump, mysqldump by table, online backups, and snapshots. It also discusses high availability options and using a slave for read-only queries. Additional sections cover database fabric sizing, pre-caching queries, new features in MySQL 5.7, and monitoring. Contact information is provided at the end for any questions.
MySQL-Mixer-LivenationMySQL-Mixer-Livenation
MySQL-Mixer-Livenation
Hari Tatrakal
12 slides536 views

Viewers also liked (20)

BlueVia SDK for .NET Overview by BlueVia, has 7 slides with 681 views.The BlueVia SDK for .NET allows .NET developers to quickly develop applications that integrate with the BlueVia platform and generate revenue. It uses familiar Visual Studio tools and templates and supports hosting applications in Microsoft Azure. Developers can get started by downloading the SDK, creating a BlueVia account, and using provided templates, documentation, and samples to build cross-platform solutions for PCs, mobile devices, and consoles.
BlueVia SDK for .NET OverviewBlueVia SDK for .NET Overview
BlueVia SDK for .NET Overview
BlueVia
7 slides681 views
Sql Overview by Randy Riness @ South Puget Sound Community College, has 13 slides with 672 views.This document provides an overview of SQL (Structured Query Language) which is used to work with databases. SQL is a non-procedural, declarative language where code describes results rather than how to perform tasks. There are different types of SQL statements including DDL for creating/editing objects, DCL for specifying access permissions, and DML for working with data. SQL uses schemas to logically organize databases and related objects within a database.
Sql OverviewSql Overview
Sql Overview
Randy Riness @ South Puget Sound Community College
13 slides672 views
Head First Java Chapter 3 by Tom Henricksen, has 11 slides with 510 views.This chapter discusses variables in Java including primitive types like int and double, reference variables that hold references to objects, and arrays. It covers declaring and assigning variables, garbage collection, and creating objects using the new keyword. Reference variables represent objects stored on the heap and use the dot operator to access methods and fields of those objects. Arrays are always objects and can hold references to other objects.
Head First Java Chapter 3Head First Java Chapter 3
Head First Java Chapter 3
Tom Henricksen
11 slides510 views
C# programming language by swarnapatil, has 13 slides with 5758 views.Brief introduction of C#, overview of c# , what is c# highlights of c#, why c# is better, code to take input in c#
C# programming languageC# programming language
C# programming language
swarnapatil
13 slides5.8K views
Html5 overview by appbackr, has 15 slides with 953 views.HTML5 is a markup language that improves and extends HTML to support the latest multimedia and complex web applications. It introduces new markup and APIs and is a potential candidate for cross-platform mobile applications. Tizen is an open-source mobile OS based on Linux that incorporates modules from MeeGo. It is designed for use in smartphones, tablets, TVs and cars and supports HTML5 and WAC web technologies for developing flexible and powerful apps.
Html5 overviewHtml5 overview
Html5 overview
appbackr
15 slides953 views
.Net overview by teach4uin, has 22 slides with 463 views.The document provides an overview of the .NET framework. It describes .NET as a language-neutral software platform and runtime that allows developers to write and execute programs in multiple languages. The .NET framework includes common language runtime (CLR) that executes code, Windows forms for desktop apps, ASP.NET for web apps, and services like ADO.NET. It supports multiple languages and compiles code to intermediate language (IL) for execution in the CLR virtual machine.
.Net overview.Net overview
.Net overview
teach4uin
22 slides463 views
Modern JavaScript Programming by Wildan Maulana, has 17 slides with 933 views.1. The document introduces object-oriented JavaScript and demonstrates how to define classes using constructor functions and prototypes. It shows how to create Lecture and Schedule classes. 2. Events and interacting with the DOM are discussed. Methods are shown for getting DOM elements and adding event listeners to manipulate elements on mouseover and mouseout. 3. The relationship between JavaScript, CSS, and AJAX is briefly covered, along with browser support considerations for modern JavaScript development.
Modern JavaScript Programming Modern JavaScript Programming
Modern JavaScript Programming
Wildan Maulana
17 slides933 views
Basic knowledge of cyber security by mahendra_chauhan, has 8 slides with 5750 views.Cyber security involves applying security measures to protect data confidentiality, integrity, and availability. It aims to safeguard assets like data, devices, networks, and people. Cyber security is important for governments, the military, corporations, financial institutions, hospitals, and personal details. Basic cyber safety actions include installing software updates, using antivirus software, enabling personal firewalls, protecting passwords, preventing identity theft, and backing up important files.
Basic knowledge of cyber securityBasic knowledge of cyber security
Basic knowledge of cyber security
mahendra_chauhan
8 slides5.8K views
cpuk10745 by Chandan Kumar, has 21 slides with 60 views.The document provides an overview of key Android concepts including: - Android is an open source, Linux-based OS developed by Andy Rubin in 2004 and acquired by Google in 2005. - The Android SDK includes tools like Android Studio and the emulator for app development using Java. - Common widgets for building apps are provided by the Android.widget package like TextView and Button. - Intents allow activities to start other components and Services run in the background. - Notifications and databases allow displaying messages and storing app data.
cpuk10745cpuk10745
cpuk10745
Chandan Kumar
21 slides60 views
Html 5 tutorial - By Bally Chohan by ballychohanuk, has 16 slides with 9323 views.This tutorial is provided by Bally Chohan UK for learning HTML 5 features and to know more about HTML 5.
Html 5 tutorial - By Bally ChohanHtml 5 tutorial - By Bally Chohan
Html 5 tutorial - By Bally Chohan
ballychohanuk
16 slides9.3K views
Expert selenium with core java by Ishita Arora, has 18 slides with 358 views.This document provides information on an expert level Selenium with Core Java training course that teaches both the basics and advanced concepts of Selenium and Java over 20 sessions of 2 hours each held on weekends. The course is taught by industry professionals and covers topics like Java programming fundamentals, OOPs concepts, collections, exceptions, files I/O, threads, networking, JDBC, JUnit, frameworks and more. It also includes a Selenium RC and WebDriver course that teaches automation using these tools. The training aims to help students with interviews and building test automation frameworks.
Expert selenium with core javaExpert selenium with core java
Expert selenium with core java
Ishita Arora
18 slides358 views
Core java over view basics introduction by quontra solutions by QUONTRASOLUTIONS, has 22 slides with 285 views.Java is an object-oriented programming language that is portable, robust, and dynamic. It is commonly used to build web applications using a three-tier architecture model. Java applications are compiled into bytecode that runs on a virtual machine, allowing them to run on any device that supports Java. The document discusses Java's features such as simplicity, object-orientation, distribution, robustness, and cross-platform capabilities. It also covers different types of Java programs including standalone programs, applets, servlets, and more.
Core java over view basics introduction by quontra solutionsCore java over view basics introduction by quontra solutions
Core java over view basics introduction by quontra solutions
QUONTRASOLUTIONS
22 slides285 views
HTML5: An Overview by Nagendra Um, has 19 slides with 2767 views.Slides from an HTML5 overview session I presented at work... This presentation has an accompanying sample webapp project: http://code.google.com/p/html5-playground
HTML5: An OverviewHTML5: An Overview
HTML5: An Overview
Nagendra Um
19 slides2.8K views
Html5 Overview by Owen Williams, has 11 slides with 772 views.The document provides an overview of HTML5 and describes several new features including content elements, native audio and video support, the canvas element for 2D drawing, new form elements, an HTML manifest for caching, offline functionality using localStorage and SQL databases, and browser support for various HTML5 features.
Html5 OverviewHtml5 Overview
Html5 Overview
Owen Williams
11 slides772 views
Low Latency Networking on IOS and Android over Cloud by Oguz Bastemur by Codemotion, has 20 slides with 976 views.For today’s mobile apps, it is quite important to provide interaction among the end users. Consider a game application have users from both Android and IOS and you want them to play together. How about scalability? low latency? user state management? Definitely, there were lots of things you had to deal with so far. On this session, I will try to simplify the things and prepare the sample apps for both IOS and Android talking each other.
Low Latency Networking on IOS and Android over Cloud by Oguz BastemurLow Latency Networking on IOS and Android over Cloud by Oguz Bastemur
Low Latency Networking on IOS and Android over Cloud by Oguz Bastemur
Codemotion
20 slides976 views
ASP.NET MVC - Javascript Overview by Dimitar Danailov, has 31 slides with 583 views.Javascript is a universal front-end platform that allows for fast and responsive web development across devices like tablets and phones. It has significant industry momentum, with usage growing from 60% in 2006 to over 100,000 frameworks and libraries in recent years. The document discusses an overview of Javascript and related topics like jQuery, Knockout.js, SignalR 2, and AngularJs.
ASP.NET MVC - Javascript OverviewASP.NET MVC - Javascript Overview
ASP.NET MVC - Javascript Overview
Dimitar Danailov
31 slides583 views
An overview of JavaScript by Poluru S, has 10 slides with 1662 views.An Introduction to JavaScript, Features, Why JavaScript, Available Programming Features in JavaScript, Some of List of Frameworks in JavaScript etc. Thanks for watching.
An overview of JavaScriptAn overview of JavaScript
An overview of JavaScript
Poluru S
10 slides1.7K views
High Level Broadband Overview by josephdebauche, has 3 slides with 152 views.This document proposes using existing wireless towers to provide broadband internet access to rural areas through a wireless network. It would connect neighborhoods, schools, healthcare facilities, fire stations and more by installing broadband equipment on towers to transmit signals up to 15 miles away. This low-cost solution of around $80,000-$120,000 per tower could provide up to 7Mbps speeds 15 miles out and 20Mbps within 2 miles to serve an area of around 700 square miles per tower.
High Level Broadband OverviewHigh Level Broadband Overview
High Level Broadband Overview
josephdebauche
3 slides152 views
Verizon Overview Broadband during DigiWorld Summit 2011 by IDATE DigiWorld, has 9 slides with 343 views.The document discusses opportunities for Internet Protocol Television (IPTV) as consumer demand for content distribution across multiple devices and platforms increases. It notes that IPTV can expand the reach of content by making it available anywhere, anytime on various devices through authentication. As broadband speeds and the number of internet-connected devices grows, the market for over-the-top video subscriptions is expected to nearly triple from 2011 to 2015, representing an opportunity for new entrants like IPTV providers.
Verizon Overview Broadband during DigiWorld Summit 2011Verizon Overview Broadband during DigiWorld Summit 2011
Verizon Overview Broadband during DigiWorld Summit 2011
IDATE DigiWorld
9 slides343 views
Ado.net by dina1985vlr, has 26 slides with 3845 views.This document provides an overview of ADO.NET compared to ADO and describes the main objects used in ADO.NET for data access like the Connection, Command, DataReader, DataAdapter, DataSet and DataView objects. It discusses how ADO.NET uses a disconnected model with the DataSet object to cache and manage data across tiers compared to ADO's coupled model. The document also includes code examples of creating a DataReader and populating a DataSet using a DataAdapter.
Ado.netAdo.net
Ado.net
dina1985vlr
26 slides3.8K views
Ad

Similar to Effective JavaScript (20)

Javascriptinobject orientedway-090512225827-phpapp02 by Sopheak Sem, has 105 slides with 288 views.The document discusses JavaScript closures. It explains that a closure occurs when an inner function is returned from an outer function and still has access to the outer function's variables even after it has returned. This is because closures combine a function and the environment in which that function was created, including any local variables that were in scope. As a result, the inner function can access and use those variables even though the outer function has finished executing. An example is provided to demonstrate how a function can return another function that still has access to the outer function's variables through a closure.
Javascriptinobject orientedway-090512225827-phpapp02Javascriptinobject orientedway-090512225827-phpapp02
Javascriptinobject orientedway-090512225827-phpapp02
Sopheak Sem
105 slides288 views
Awesomeness of JavaScript…almost by Quinton Sheppard, has 66 slides with 1469 views.This document provides an agenda and overview for a presentation on JavaScript. It discusses JavaScript's history and popularity, current implementations of JavaScript engines in browsers, and proliferation of JavaScript frameworks. The agenda outlines discussing objects, functions, scope, primitives, common mistakes, inheritance, best practices, modularity, and more. It also includes code examples demonstrating functions, closures, scope, operators, and error handling in JavaScript.
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almost
Quinton Sheppard
66 slides1.5K views
JavaScript Basics and Best Practices - CC FE & UX by JWORKS powered by Ordina, has 57 slides with 1317 views.This document provides an overview and introduction to JavaScript basics and best practices. It covers what JavaScript is, how engines work, language features, and future developments like ES6. The basics section discusses types, variables, expressions, statements, functions, objects, and prototypical inheritance. The best practices section focuses on techniques for enterprise applications. The document is intended to help front-end developers learn JavaScript fundamentals.
JavaScript Basics and Best Practices - CC FE & UXJavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UX
JWORKS powered by Ordina
57 slides1.3K views
Advanced JavaScript by Fu Cheng, has 41 slides with 1712 views.JavaScript language plays a very important role in Web 2.0 application development. JavaScript has its own characteristics different than object-oriented languages and it's not easy for developers to understand. This presentation covers major advanced topics in JavaScript languages, including prototype chain, identifier resolving, "this" keyword, "new" operator, execution context and scope chain and closure. Besides that, it also covers best practices when using JavaScript.
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
Fu Cheng
41 slides1.7K views
Javascript Best Practices and Intro to Titanium by Techday7, has 30 slides with 1049 views.Javascript is a programming language used for web pages and server-side applications. It allows for dynamic scripts and efficient coding practices like self-calling functions. The document discusses Javascript best practices such as avoiding global scope, using 'var' for variables, and leveraging closures. It also covers object-oriented programming in Javascript and building cross-platform mobile apps using frameworks like Titanium.
Javascript Best Practices and Intro to TitaniumJavascript Best Practices and Intro to Titanium
Javascript Best Practices and Intro to Titanium
Techday7
30 slides1K views
[2015/2016] JavaScript by Ivano Malavolta, has 86 slides with 728 views.JavaScript basics JavaScript event loop Ajax and promises DOM interaction JavaScript object orientation Web Workers Useful Microframeworks This presentation has been developed in the context of the Mobile Applications Development course, DISIM, University of L'Aquila (Italy), Spring 2016. http://www.ivanomalavolta.com
[2015/2016] JavaScript[2015/2016] JavaScript
[2015/2016] JavaScript
Ivano Malavolta
86 slides728 views
ECMAScript 2015 by Sebastian Pederiva, has 64 slides with 452 views.The document summarizes key features of ECMAScript 2015 (ES6). It discusses classes, modules, arrow functions, default parameters, template literals, and block scoping with let and const. Classes provide clearer syntax for object creation and inheritance compared to ES5. Modules allow importing and exporting bindings. Arrow functions provide a concise syntax, preserve this binding, and cannot be called with new. Default parameters and template literals also introduce new functionality.
ECMAScript 2015ECMAScript 2015
ECMAScript 2015
Sebastian Pederiva
64 slides452 views
Unit-3.pptx node js ppt documents semester-5 by makanijenshi2409, has 95 slides with 3 views.node js ppt presentation fos subject full stack development utu cgpit maliba compus geeks for geeks information technology computer science predents education deep learning
Unit-3.pptx node js ppt documents semester-5Unit-3.pptx node js ppt documents semester-5
Unit-3.pptx node js ppt documents semester-5
makanijenshi2409
95 slides3 views
Java script Techniques Part I by Luis Atencio, has 48 slides with 750 views.Part I of a presentation on Advanced Concepts in JavaScript. Cover topics like: objects, functions, closures, inheritance, new platform features, and much more. Read more: http://luisatencio.net
Java script Techniques Part IJava script Techniques Part I
Java script Techniques Part I
Luis Atencio
48 slides750 views
Java scriptforjavadev part1 by Makarand Bhatambarekar, has 11 slides with 837 views.This document provides an agenda and overview for a workshop on JavaScript essentials for Java developers. It covers setting up a development environment, core JavaScript concepts like objects and functions, working with the DOM, debugging tools, and optimizing JavaScript performance. The first part focuses on fundamental JavaScript skills like variables, operators, functions, closures, and the window and document objects. The second part will cover JSON and JavaScript classes, as well as jQuery, Ajax, and best practices for loading scripts and CSS. Attendees will have a chance to ask questions and take a short quiz to test their understanding.
Java scriptforjavadev part1Java scriptforjavadev part1
Java scriptforjavadev part1
Makarand Bhatambarekar
11 slides837 views
Javascript Performance by olivvv, has 59 slides with 1163 views.The document provides guidelines and best practices for optimizing JavaScript code. It discusses when optimization may not be needed, as JavaScript engines continue to improve in speed. It identifies potentially expensive operations like XMLHttpRequests to servers and DOM interactions. It also notes the complexity of JavaScript engines and compilers, and that hand optimizations may not help and could make code less readable. Profiling is recommended before optimizing.
Javascript PerformanceJavascript Performance
Javascript Performance
olivvv
59 slides1.2K views
Javascript closures by VNG, has 20 slides with 313 views.introduction, The Resolution of Property Names on Objects. Closure A "closure" is an expression (typically a function) that can have free variables together with an environment that binds those variables (that "closes" the expression)
Javascript closures Javascript closures
Javascript closures
VNG
20 slides313 views
All of javascript by Togakangaroo, has 41 slides with 1723 views.This document provides an overview of JavaScript concepts and best practices. It discusses objects as hashes, functions as first-class objects, loose typing, closures, prototypes, JSON, cross-domain AJAX, testing with Jasmine, CoffeeScript, libraries like jQuery, global scope issues, regular expressions, XSS, hoisting, and other JavaScript quirks. It also provides resources for further learning JavaScript.
All of javascriptAll of javascript
All of javascript
Togakangaroo
41 slides1.7K views
Solid JavaScript Coding by Diwa Del Mundo, has 23 slides with 756 views.JavaScript Review session conducted during the Solid JavaScript Session in Voyager Innovations, May 25, 2015. Coverage includes: - Variables - Objects - This - Hoisting - Functions - Immediate - Currying - Constructor Functions - Closures Companion repo: https://github.com/diwadm/solid-js-coding
Solid JavaScript CodingSolid JavaScript Coding
Solid JavaScript Coding
Diwa Del Mundo
23 slides756 views
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra by Sencha, has 93 slides with 426 views.In this session, Lee will cover the top 10 new features of ECMAScript 2015, their benefits, and go through code examples of how to use them. She will also talk about ECMAScript 2015 compatibilities and incompatibilities with the most widely used browsers today, and how you should plan on developing your applications with ECMAScript 2015.
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra  SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
Sencha
93 slides426 views
Run-time of Node.js : V8 JavaScript Engine by Gary Yeh, has 30 slides with 3207 views.This document discusses the runtime of Node.js and its V8 JavaScript engine. It describes how V8 uses fast property access through hidden classes, dynamic machine code generation to compile JavaScript directly to machine code, and efficient garbage collection. It also provides an example "Hello World" Node.js program.
Run-time of Node.js: V8 JavaScript EngineRun-time of Node.js: V8 JavaScript Engine
Run-time of Node.js : V8 JavaScript Engine
Gary Yeh
30 slides3.2K views
Exciting JavaScript - Part I by Eugene Lazutkin, has 62 slides with 6948 views.JavaScript and popular programming paradigms (OOP, AOP, FP, DSL). Overview of the language to see what tools we can leverage to reduce complexity of our projects. This part goes over language features and looks at OOP and AOP with JavaScript. The presentation was delivered at ClubAJAX on 2/2/2010. Blog post: http://lazutkin.com/blog/2010/feb/5/exciting-js-1/ Continued in Part II: http://www.slideshare.net/elazutkin/exciting-javascript-part-ii
Exciting JavaScript - Part IExciting JavaScript - Part I
Exciting JavaScript - Part I
Eugene Lazutkin
62 slides6.9K views
java script functions, classes by Vijay Kalyan, has 37 slides with 760 views.The document discusses JavaScript functions, classes, and regular expressions. It covers: 1) How functions are defined and invoked in JavaScript and the different ways functions can be invoked like as methods, constructors, or indirectly. 2) How classes are implemented in JavaScript using prototypes and constructor functions to define behaviors shared across objects. 3) How regular expressions can be used to describe patterns in strings using special characters like character classes, repetition, and other techniques.
java script functions, classesjava script functions, classes
java script functions, classes
Vijay Kalyan
37 slides760 views
Intermediate JavaScript by ☆ Milan Adamovsky ☆, has 79 slides with 1357 views.These are slides I use in my Professional Intermediate JavaScript classes. Contact me to schedule training.
Intermediate JavaScriptIntermediate JavaScript
Intermediate JavaScript
☆ Milan Adamovsky ☆
79 slides1.4K views
JS by scandiweb, has 22 slides with 282 views.The document provides an overview of various Javascript concepts that will and will not be covered. It begins with defining scope as the area of variable visibility and provides examples to demonstrate how scope works. It then discusses self-invoking anonymous functions (SAFs), explaining how they immediately invoke themselves and can accept arguments. Closures are explained with examples showing how they allow accessing outer function variables. The document also covers objects and classes in Javascript, providing examples of creating classes and class instances that inherit properties and methods.
JSJS
JS
scandiweb
22 slides282 views
Ad

Recently uploaded (20)

Optimize IBM i with Consulting Services Help by Alice Gray, has 8 slides with 16 views.We offers a comprehensive overview of legacy system modernization, integration, and support services. It highlights key challenges businesses face with IBM i systems and presents tailored solutions such as modernization strategies, application development, and managed services. Ideal for IT leaders and enterprises relying on AS400, the deck includes real-world case studies, engagement models, and the benefits of expert consulting. Perfect for showcasing capabilities to clients or internal stakeholders.
Optimize IBM i with Consulting Services HelpOptimize IBM i with Consulting Services Help
Optimize IBM i with Consulting Services Help
Alice Gray
8 slides16 views
John Carmack’s Slides From His Upper Bound 2025 Talk by Razin Mustafiz, has 31 slides with 59 views.Source: https://docs.google.com/presentation/d/1GmGe9ref1nxEX_ekDuJXhildpWGhLEYBMeXCclVECek/edit?usp=sharing
John Carmack’s Slides From His Upper Bound 2025 TalkJohn Carmack’s Slides From His Upper Bound 2025 Talk
John Carmack’s Slides From His Upper Bound 2025 Talk
Razin Mustafiz
31 slides59 views
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips by Patryk Bandurski, has 25 slides with 79 views.This presentation was delivered during the Warsaw MuleSoft Meetup in April 2025. Paulina Uhman (PwC Polska) shared her hands-on experience running MuleSoft Runtime Fabric (RTF) and Flex Gateway on Azure Kubernetes Service (AKS). The deck covers: What happens after installation (pods, services, and artifacts demystified) Shared responsibility model: MuleSoft vs Kubernetes Real-world tips for configuring connectivity Key Kubernetes commands for troubleshooting Lessons learned from practical use cases 🎙️ Hosted by: Patryk Bandurski, MuleSoft Ambassador & Meetup Leader 💡 Presented by: Paulina Uhman, Integration Specialist @ PwC Polska
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World TipsMuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips
Patryk Bandurski
25 slides79 views
The fundamental misunderstanding in Team Topologies by Patricia Aas, has 72 slides with 2260 views.In this talk I will break down the argument presented in the book and argue that it is fundamentally ill-conceived, building on weak and erroneous assumptions. And that this leads to a "solution" that is not only flawed, but outright wrong, and might cost your organization vast sums of money for far inferior results.
The fundamental misunderstanding in Team TopologiesThe fundamental misunderstanding in Team Topologies
The fundamental misunderstanding in Team Topologies
Patricia Aas
72 slides2.3K views
Reducing Bugs With Static Code Analysis php tek 2025 by Scott Keck-Warren, has 186 slides with 58 views.Have you ever deployed code only to have it causes errors and unexpected results? By using static code analysis we can reduce, if not completely remove this risk. In this session, we'll discuss the basics of static code analysis, some free and inexpensive tools we can use, and how we can run the tools successfully.
Reducing Bugs With Static Code Analysis php tek 2025Reducing Bugs With Static Code Analysis php tek 2025
Reducing Bugs With Static Code Analysis php tek 2025
Scott Keck-Warren
186 slides58 views
CloudStack + KVM: Your Local Cloud Lab by ShapeBlue, has 16 slides with 156 views.Setting up a local cloud environment for development and testing can be complex, but with Apache CloudStack and KVM, it becomes a powerful and flexible solution. This talk guided attendees through the process of creating a fully functional CloudStack-powered private cloud on a local machine or server, using KVM as the hypervisor and Ansible for automation. -- The CloudStack European User Group 2025 took place on May 8th in Vienna, Austria. The event once again brought together open-source cloud professionals, contributors, developers, and users for a day of deep technical insights, knowledge sharing, and community connection.
CloudStack + KVM:   Your Local Cloud LabCloudStack + KVM:   Your Local Cloud Lab
CloudStack + KVM: Your Local Cloud Lab
ShapeBlue
16 slides156 views
Multi-Agent AI Systems: Architectures & Communication (MCP and A2A) by HusseinMalikMammadli, has 27 slides with 180 views.Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)
Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)
Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)
HusseinMalikMammadli
27 slides180 views
STKI Annual Israel IT Market Study 2025 . by Dr. Jimmy Schwarzkopf, has 476 slides with 100 views.Annual (33 years) study of the Israeli Enterprise / public IT market. Covering sections on Israeli Economy, IT trends 2026-28, several surveys (AI, CDOs, OCIO, CTO, staffing cyber, operations and infra) plus rankings of 760 vendors on 160 markets (market sizes and trends) and comparison of products according to support and market penetration.
STKI Annual Israel IT Market Study 2025 .STKI Annual Israel IT Market Study 2025 .
STKI Annual Israel IT Market Study 2025 .
Dr. Jimmy Schwarzkopf
476 slides100 views
AI needs Hybrid Cloud - TEC conference 2025.pptx by Shikha Srivastava, has 17 slides with 72 views.Engaging interactive session at the Carolina TEC Conference—had a great time presenting the intersection of AI and hybrid cloud, and discussing the exciting momentum the #HashiCorp acquisition brings to #IBM."
AI needs Hybrid Cloud - TEC conference 2025.pptxAI needs Hybrid Cloud - TEC conference 2025.pptx
AI needs Hybrid Cloud - TEC conference 2025.pptx
Shikha Srivastava
17 slides72 views
GraphSummit Singapore Master Deck - May 20, 2025 by Neo4j, has 135 slides with 281 views.GraphSummit Singapore Master Deck - May 20, 2025
GraphSummit Singapore Master Deck - May 20, 2025GraphSummit Singapore Master Deck - May 20, 2025
GraphSummit Singapore Master Deck - May 20, 2025
Neo4j
135 slides281 views
Artificial Intelligence (Kecerdasan Buatan).pdf by NufiEriKusumawati, has 10 slides with 42 views.AI stands for Artificial Intelligence. It refers to the ability of a computer system or machine to perform tasks that usually require human intelligence, such as: thinking, learning from experience, solving problems, and making decisions.
Artificial Intelligence (Kecerdasan Buatan).pdfArtificial Intelligence (Kecerdasan Buatan).pdf
Artificial Intelligence (Kecerdasan Buatan).pdf
NufiEriKusumawati
10 slides42 views
Fully Open-Source Private Clouds: Freedom, Security, and Control by ShapeBlue, has 12 slides with 42 views.In this presentation, Swen Brüseke introduced proIO's strategy for 100% open-source driven private clouds. proIO leverage the proven technologies of CloudStack and LINBIT, complemented by professional maintenance contracts, to provide you with a secure, flexible, and high-performance IT infrastructure. He highlighted the advantages of private clouds compared to public cloud offerings and explain why CloudStack is in many cases a superior solution to Proxmox. -- The CloudStack European User Group 2025 took place on May 8th in Vienna, Austria. The event once again brought together open-source cloud professionals, contributors, developers, and users for a day of deep technical insights, knowledge sharing, and community connection.
Fully Open-Source Private Clouds: Freedom, Security, and ControlFully Open-Source Private Clouds: Freedom, Security, and Control
Fully Open-Source Private Clouds: Freedom, Security, and Control
ShapeBlue
12 slides42 views
AI in Java - MCP in Action, Langchain4J-CDI, SmallRye-LLM, Spring AI by Buhake Sindi, has 35 slides with 20 views.This is the presentation I gave with regards to AI in Java, and the work that I have been working on. I've showcased Model Context Protocol (MCP) in Java, creating server-side MCP server in Java. I've also introduced Langchain4J-CDI, previously known as SmallRye-LLM, a CDI managed too to inject AI services in enterprise Java applications. Also, honourable mention: Spring AI.
AI in Java - MCP in Action, Langchain4J-CDI, SmallRye-LLM, Spring AIAI in Java - MCP in Action, Langchain4J-CDI, SmallRye-LLM, Spring AI
AI in Java - MCP in Action, Langchain4J-CDI, SmallRye-LLM, Spring AI
Buhake Sindi
35 slides20 views
Introducing High Availability: Business Continuity for Every NAS User by QNAP Marketing, has 30 slides with 38 views.Slidedeck for Introducing High Availability: Business Continuity for Every NAS User Webinar hosted by QNAP (May 20, 2025)
Introducing High Availability: Business Continuity for Every NAS UserIntroducing High Availability: Business Continuity for Every NAS User
Introducing High Availability: Business Continuity for Every NAS User
QNAP Marketing
30 slides38 views
AI Unboxed - How to Approach AI for Maximum Return by Merelda, has 38 slides with 17 views.Keynote for a client. In this session, Merelda addressed common misconceptions about AI technologies, particularly the confusion between Predictive AI and Generative AI, and provided clarity on when to use each. Predictive AI analyzes historical data to forecast future outcomes, while Generative AI creates new content, from text to images, rapidly. Understanding the differences between these technologies is crucial for making informed, strategic decisions. She introduced the three archetypes of AI adoption: Takers, Shapers, and Makers, inviting the audience to identify which role their organisation plays. Based on these archetypes, she presented industry-specific examples relevant to Schauenburg’s portfolio, showcasing how Predictive AI can drive operational efficiency (e.g., predicting equipment maintenance), while Generative AI enhances customer interactions (e.g., generating technical documents). The session received a 10/10 rating from attendees for its practical insights and immediate applicability.
AI Unboxed - How to Approach AI for Maximum ReturnAI Unboxed - How to Approach AI for Maximum Return
AI Unboxed - How to Approach AI for Maximum Return
Merelda
38 slides17 views
SQL Database Design For Developers at PhpTek 2025.pptx by Scott Keck-Warren, has 204 slides with 100 views.Databases are the magic box in a lot of our workflows and in this presentation I show you my rules for better database design
SQL Database Design For Developers at PhpTek 2025.pptxSQL Database Design For Developers at PhpTek 2025.pptx
SQL Database Design For Developers at PhpTek 2025.pptx
Scott Keck-Warren
204 slides100 views
NVIDIA’s Enterprise AI Factory and Blueprints_ Paving the Way for Smart, Scal... by derrickjswork, has 9 slides with 15 views.In a landmark step toward making autonomous AI agents practical and production-ready for enterprises, NVIDIA has launched the Enterprise AI Factory validated design and a set of AI Blueprints. This initiative is a critical leap in transitioning generative AI from experimental projects to business-critical infrastructure. Designed for CIOs, developers, and AI strategists alike, these new offerings provide the architectural backbone and application templates necessary to build AI agents that are scalable, secure, and capable of complex reasoning — all while being deeply integrated with enterprise systems.
NVIDIA’s Enterprise AI Factory and Blueprints_ Paving the Way for Smart, Scal...NVIDIA’s Enterprise AI Factory and Blueprints_ Paving the Way for Smart, Scal...
NVIDIA’s Enterprise AI Factory and Blueprints_ Paving the Way for Smart, Scal...
derrickjswork
9 slides15 views
Build your own NES Emulator... with Kotlin by Artur Skowroński, has 122 slides with 291 views.For those who have ever wanted to recreate classic games, this presentation covers my five-year journey to build a NES emulator in Kotlin. Starting from scratch in 2020 (you can probably guess why), I’ll share the challenges posed by the architecture of old hardware, performance optimization (surprise, surprise), and the difficulties of emulating sound. I’ll also highlight which Kotlin features shine (and why concurrency isn’t one of them). This high-level overview will walk through each step of the process—from reading ROM formats to where GPT can help, though it won’t write the code for us just yet. We’ll wrap up by launching Mario on the emulator (hopefully without a call from Nintendo).
Build your own NES Emulator... with KotlinBuild your own NES Emulator... with Kotlin
Build your own NES Emulator... with Kotlin
Artur Skowroński
122 slides291 views
PSEP - Salesforce Power of the Platform.pdf by ssuser3d62c6, has 98 slides with 18 views.This PDF document is a presentation for the Salesforce Partner Success Enablement Program (PSEP), focusing on the "Power of the Platform." It highlights Salesforce’s core platform capabilities, including customization, integration, automation, and scalability. The deck demonstrates how partners can leverage Salesforce’s robust tools and ecosystem to build innovative business solutions, accelerate digital transformation, and drive customer success. It serves as an educational resource to empower partners with knowledge about the platform’s strengths and best practices for solution development and deployment.
PSEP - Salesforce Power of the Platform.pdfPSEP - Salesforce Power of the Platform.pdf
PSEP - Salesforce Power of the Platform.pdf
ssuser3d62c6
98 slides18 views
Planetek Italia Corporate Profile Brochure by Planetek Italia Srl, has 44 slides with 133 views.Planetek Italia is an Italian Benefit Company established in 1994, which employs 130+ women and men, passionate and skilled in Geoinformatics, Space solutions, and Earth science. We provide solutions to exploit the value of geospatial data through all phases of data life cycle. We operate in many application areas ranging from environmental and land monitoring to open-government and smart cities, and including defence and security, as well as Space exploration and EO satellite missions.
Planetek Italia Corporate Profile BrochurePlanetek Italia Corporate Profile Brochure
Planetek Italia Corporate Profile Brochure
Planetek Italia Srl
44 slides133 views

Effective JavaScript

Editor's Notes

  • #12: No block scope. In general you reference enclosing functions and their arguments until you reach the global scope. With is an exception.
  • #13: This isn’t as true in v8.
  • #14: Referencing a is 4 steps away!
  • #15: If something isn’t defined in the object in your with statement, you create a global. If it is, you overwrite that property. It’s difficult to tell from reading the code how an assignment might affect the program.
  • #19: And you can combine the two!
  • #20: This avoids a step on the scope chain.
  • #21: Minimize your code, don’t keep functions around that are one-offs. On the other hand, this function is recreated every time.
  • #22: As always with closures, watch for memory leaks.
  • #31: Be careful though, unlike other languages with getters and setters, Javascript won’t warn you if you access an undefined property. It’ll just return undefined.