This document provides an overview of key features introduced in ECMAScript 6 (ES6), also known as ECMAScript 2015. It discusses arrow functions, block scoping with let and const, string templates, enhanced object properties, destructuring assignments, default and rest parameters for functions, iterators and generators, and more. Each new feature is explained with examples showing how it improves upon ECMAScript 5 syntax and capabilities.
Attributes Unwrapped: Lessons under the surface of active record.toster
Ведущий разработчик Ruby on Rails (Rails Core member) Джон Лейтон не так давно работал над совершенствованием реализации работы с атрибутами в Active Record. Он расскажет о своем опыте работы над важной для производительности областью Rails, даст советы и расскажет о техниках, которые могут быть применены к собственным приложениям слушателей.
Говоря о будущем, Джон также расскажет о своих идеях по изменению API работы с атрибутами в лучшую сторону; эти изменения могут появиться в Rails 4.0.
Introduction to ad-3.4, an automatic differentiation library in Haskellnebuta
Haskellの自動微分ライブラリ Ad-3.4 の紹介(の試み) If you don't see 21 slides in this presentation, try this one (re-uploaded): http://www.slideshare.net/nebuta/130329-ad-by-ekmett
This document discusses how Vim can improve productivity for Perl coding. It provides examples of using Vim motions and modes like Normal mode, Insert mode, and Visual mode to efficiently edit code. It also covers Vim features like syntax highlighting, custom syntax files, key mappings, and text objects that are useful for Perl. The document advocates that Vim is a powerful editor rather than an IDE and highlights how it can save significant time compared to less efficient editing methods.
This document provides a history of ECMAScript (ES) and JavaScript standards. It discusses the origins of JavaScript in 1995 and its standardization by ECMA in 1997 as ECMAScript. New versions were released periodically, including ES5 in 2009 and ES6 in 2015. ES6 was also referred to as ES2015 since version names going forward would be based on the year of release.
"How was it to switch from beautiful Perl to horrible JavaScript", Viktor Tur...Fwdays
The document provides biographical information about Viktor Turskyi, including his professional experience as a non-executive director, founder, senior software engineer, and open source developer with over 20 years of experience in IT. It also lists some of his conference talks and delivered projects. The remaining slides provide examples and explanations of JavaScript and Perl concepts like data types, operators, functions, objects and arrays.
This document provides an overview of the awk programming language including its syntax, working methodology, built-in variables, operators, and examples. Some key points:
- Awk programs use patterns and actions to process input files line by line. Patterns are matched against each record and associated actions are performed.
- Built-in variables like FS, OFS, RS, NR, NF, FILENAME help manipulate the input/output and provide record information.
- Operators allow arithmetic, string, comparison, assignment and regular expression operations.
- Examples demonstrate using built-ins and operators to count fields, select records, and manipulate data from /etc/passwd.
This document describes a presentation on using the Tagless Final style in the Play Framework for purely functional programming.
The presentation introduces Play Framework and how it uses Google Guice for dependency injection. It discusses separating the program from its execution using techniques like the Reader Monad and Free Monad. However, these have drawbacks like being difficult to use with multiple dependencies.
The presentation then introduces Tagless Final style as an alternative that has less boilerplate than Free Monad and allows separating program and implementation. It demonstrates a basic example of a UserRepository trait and implementation.
The rest of the agenda covers practicing Tagless Final style in the Play Framework, discussing its advantages but also that it is not a silver bullet
This is the seventh set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
Attributes Unwrapped: Lessons under the surface of active record.toster
Ведущий разработчик Ruby on Rails (Rails Core member) Джон Лейтон не так давно работал над совершенствованием реализации работы с атрибутами в Active Record. Он расскажет о своем опыте работы над важной для производительности областью Rails, даст советы и расскажет о техниках, которые могут быть применены к собственным приложениям слушателей.
Говоря о будущем, Джон также расскажет о своих идеях по изменению API работы с атрибутами в лучшую сторону; эти изменения могут появиться в Rails 4.0.
Introduction to ad-3.4, an automatic differentiation library in Haskellnebuta
Haskellの自動微分ライブラリ Ad-3.4 の紹介(の試み) If you don't see 21 slides in this presentation, try this one (re-uploaded): http://www.slideshare.net/nebuta/130329-ad-by-ekmett
This document discusses how Vim can improve productivity for Perl coding. It provides examples of using Vim motions and modes like Normal mode, Insert mode, and Visual mode to efficiently edit code. It also covers Vim features like syntax highlighting, custom syntax files, key mappings, and text objects that are useful for Perl. The document advocates that Vim is a powerful editor rather than an IDE and highlights how it can save significant time compared to less efficient editing methods.
This document provides a history of ECMAScript (ES) and JavaScript standards. It discusses the origins of JavaScript in 1995 and its standardization by ECMA in 1997 as ECMAScript. New versions were released periodically, including ES5 in 2009 and ES6 in 2015. ES6 was also referred to as ES2015 since version names going forward would be based on the year of release.
"How was it to switch from beautiful Perl to horrible JavaScript", Viktor Tur...Fwdays
The document provides biographical information about Viktor Turskyi, including his professional experience as a non-executive director, founder, senior software engineer, and open source developer with over 20 years of experience in IT. It also lists some of his conference talks and delivered projects. The remaining slides provide examples and explanations of JavaScript and Perl concepts like data types, operators, functions, objects and arrays.
This document provides an overview of the awk programming language including its syntax, working methodology, built-in variables, operators, and examples. Some key points:
- Awk programs use patterns and actions to process input files line by line. Patterns are matched against each record and associated actions are performed.
- Built-in variables like FS, OFS, RS, NR, NF, FILENAME help manipulate the input/output and provide record information.
- Operators allow arithmetic, string, comparison, assignment and regular expression operations.
- Examples demonstrate using built-ins and operators to count fields, select records, and manipulate data from /etc/passwd.
This document describes a presentation on using the Tagless Final style in the Play Framework for purely functional programming.
The presentation introduces Play Framework and how it uses Google Guice for dependency injection. It discusses separating the program from its execution using techniques like the Reader Monad and Free Monad. However, these have drawbacks like being difficult to use with multiple dependencies.
The presentation then introduces Tagless Final style as an alternative that has less boilerplate than Free Monad and allows separating program and implementation. It demonstrates a basic example of a UserRepository trait and implementation.
The rest of the agenda covers practicing Tagless Final style in the Play Framework, discussing its advantages but also that it is not a silver bullet
This is the seventh set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
This document discusses new features coming to JavaScript in ECMAScript 6, including:
1) Block scope keywords "let" and "const" that allow for block-level scoping of variables.
2) Shorthand syntax for object literals and method definitions.
3) Destructuring assignments for extracting values from objects and arrays.
4) Default parameter values, rest parameters, and spread syntax for working with functions and arrays.
5) New features like modules, classes, and imports for better organizing code.
This document provides an introduction and overview of ECMAScript 6 (ES6), the latest version of JavaScript. It discusses setting up the development environment with Node.js and npm. Key ES6 features covered include arrow functions, block scoping, template literals, destructuring, classes, modules, and promises. The document consists of 9 lectures with demonstrations of these new JavaScript features. It aims to help readers learn the major updates and capabilities introduced in ES6.
This document provides an agenda for discussing JavaScript ES6 features such as promises, arrow functions, constants, modules, classes, transpilation, default parameters, and template strings. It also discusses how to use ES6 today via transpilation with tools like Babel and Traceur, and which companies are using ES6 and those transpilation tools.
This is the second set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
The document discusses functions in PHP, including defining functions, passing arguments to functions, returning values from functions, and using global variables. Some key points covered include:
- Functions allow code to be reused and separated into logical subsections, making code more modular, readable, and maintainable.
- Arguments passed to functions can make functions more flexible by allowing different inputs to produce different outputs each time they are called.
- Functions can return values to the calling code using the return statement. Returned values can be variables, arrays, or results of calculations.
- The order arguments are passed to a function matters, as arguments are assigned to placeholder variables in the defined order. Default values can be specified for arguments.
This document discusses Python decorators. Decorators allow functions to be modified or extended without permanently changing them. Decorators are functions that take other functions as arguments and return modified functions. The @ syntax is used to decorate a function, which is equivalent to calling the decorator on the function. Decorators can be used to add logging, timing, caching, and other functionality to existing functions without changing the code. Well-designed decorators allow the decorated function to be called normally while changing its behavior behind the scenes.
ES6, also known as ECMAScript 2015, introduces many new features to JavaScript that allow for clearer, more concise code. Some major features include let and const for block scoping, arrow functions, classes, template strings, collections like Maps and Sets, and iterators and generators. New features like default parameters, rest/spread syntax, and destructuring make working with functions and arrays more flexible. Overall, ES6 enhances JavaScript's syntax and capabilities in many ways.
FITC events. For digital creators.
Save 10% off ANY FITC event with discount code 'slideshare'
See our upcoming events at www.fitc.ca
An Intro To ES6
with Grant Skinner
OVERVIEW
ECMAScript 6 is the approved and published standard for the next version of JavaScript. It offers new syntax and language features that provide new ways of tackling coding problems, and increase your productivity.
This session will introduce ES6 and delve into many of the new features of the language. It will also cover real-world use, including transpilers, runtimes, and browser support.
OBJECTIVE
Create confidence in evaluating and getting started using ES6.
TARGET AUDIENCE
JavaScript developers.
ASSUMED AUDIENCE KNOWLEDGE
JavaScript.
FOUR THINGS AUDIENCE MEMBERS WILL LEARN
Status of ES6
How to get started with ES6
ES6 feature overview
Practical considerations for adopting ES6
The document provides an agenda for a talk on modeling a Rubik's Cube in JavaScript. It begins with an introduction to scripting languages and ECMAScript. It then discusses modeling a Rubik's Cube by first walking through the code, then modeling the cube and finding moves to solve it. The document covers topics like scripting languages, ECMAScript, object-oriented programming concepts in JavaScript, and modeling a Rubik's Cube to be manipulated programmatically.
The document compares and contrasts features of the Scala and Ruby programming languages, including type systems, pattern matching, monkey patching, dynamic calls, traits/modules, and more. It discusses how each language handles the given features, often providing code examples, and notes similarities and differences between the two approaches. The overall assessment is that a draw is the best way to characterize the comparison between Scala and Ruby, as both languages have their merits for different use cases and preferences.
The document discusses the use of references in Perl programming. It describes how dispatch tables can be used to implement functions by storing references to functions in a hash and calling them via their keys. It also discusses higher-order functions, which are functions that can take other functions as arguments or return functions. The document provides examples of defining higher-order functions and passing function references between subroutines in Perl.
Python decorators allow functions and classes to be augmented or modified by wrapper objects. Decorators take the form of callable objects that process other callable objects like functions and classes. Decorators are applied once when a function or class is defined, making augmentation logic explicit and avoiding the need to modify call sites. Decorators can manage state information, handle multiple instances, and take arguments to customize behavior. However, decorators also introduce type changes and extra function calls that incur performance costs.
Programming Using Tcl/Tk
Tcl/Tk is a scripting language and widget toolkit. Tcl is used to write scripts and can be extended with C. Tk provides widgets to build graphical user interfaces. Simple programs in Tcl/Tk are easy to write, but more complex tasks are also possible. The language has no formal grammar but uses commands, variables, and substitutions to provide programming capabilities.
This document provides a history of JavaScript and ECMAScript specifications from 1995 to the present. It discusses the standardization process and key people and organizations involved like B. Eich, TC39, and ECMA. Major versions and proposed features are summarized, including ES6/ES2015 additions like arrow functions, block scoping with let/const, classes, modules, iterators/generators, and proxies.
This course provides you with skills to
* Develop sed and awk scripts
* Use sed and awk to automate common tasks
* Use sed and awk to create formatted reports
Prerequisites
* Basic understanding of UNIX / Linux Operating System
* Knowledge of basic UNIX / Linux commands
Intended Audience
* System Administrators, Testing Professionals, and Software Developers working in the UNIX / Linux environment
This document discusses JavaScript best practices for naming variables and functions, code formatting and style, scopes and closures, and class-like structures. It provides examples of how to use descriptive names, consistent formatting, closures to manage variable scopes, immediately invoked function expressions (IIFEs), and dataclass structures in Wakanda to define classes. Following these practices can improve code readability, maintainability and reduce bugs.
This is the third set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
Decorators in Python allow functions and methods to be modified by wrapping them in another callable object. Decorators provide a lightweight way to add reusable behavior to code. However, decorators can make functions difficult to test and introduce tight coupling. Alternatives like inheritance and mixins may provide a cleaner approach in some cases.
This is brief presentation on the Scala programming language. It is aimed at Java developers who are curious about Scala. It was given at a San Francisco Java User Group in January 2009.
This document provides an overview of several new features introduced in ECMAScript 6 (ES6), including:
1. Arrow functions which provide a shorter syntax for writing function expressions and retain the lexical this value.
2. Block scoping with let which allows block-level scoping of variables replacing the need for IIFEs in ES5. const is also introduced for single-assignment constants.
3. String templates which make it easier to construct strings and allow interpolation of variables and expressions.
This document provides an overview of ES6 features and how to set them up for use in Ruby on Rails applications. It describes key ES6 features such as let and const block scoping, template strings, destructuring assignment, default and rest parameters, loops and generators, enhanced object literals, Maps and Sets, arrow functions, modules, and classes. It then provides instructions for using the sprockets-es6 gem to transpile ES6 code to ES5 for use in Rails, as well as using Node.js and Gulp as an alternative approach.
This document discusses new features coming to JavaScript in ECMAScript 6, including:
1) Block scope keywords "let" and "const" that allow for block-level scoping of variables.
2) Shorthand syntax for object literals and method definitions.
3) Destructuring assignments for extracting values from objects and arrays.
4) Default parameter values, rest parameters, and spread syntax for working with functions and arrays.
5) New features like modules, classes, and imports for better organizing code.
This document provides an introduction and overview of ECMAScript 6 (ES6), the latest version of JavaScript. It discusses setting up the development environment with Node.js and npm. Key ES6 features covered include arrow functions, block scoping, template literals, destructuring, classes, modules, and promises. The document consists of 9 lectures with demonstrations of these new JavaScript features. It aims to help readers learn the major updates and capabilities introduced in ES6.
This document provides an agenda for discussing JavaScript ES6 features such as promises, arrow functions, constants, modules, classes, transpilation, default parameters, and template strings. It also discusses how to use ES6 today via transpilation with tools like Babel and Traceur, and which companies are using ES6 and those transpilation tools.
This is the second set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
The document discusses functions in PHP, including defining functions, passing arguments to functions, returning values from functions, and using global variables. Some key points covered include:
- Functions allow code to be reused and separated into logical subsections, making code more modular, readable, and maintainable.
- Arguments passed to functions can make functions more flexible by allowing different inputs to produce different outputs each time they are called.
- Functions can return values to the calling code using the return statement. Returned values can be variables, arrays, or results of calculations.
- The order arguments are passed to a function matters, as arguments are assigned to placeholder variables in the defined order. Default values can be specified for arguments.
This document discusses Python decorators. Decorators allow functions to be modified or extended without permanently changing them. Decorators are functions that take other functions as arguments and return modified functions. The @ syntax is used to decorate a function, which is equivalent to calling the decorator on the function. Decorators can be used to add logging, timing, caching, and other functionality to existing functions without changing the code. Well-designed decorators allow the decorated function to be called normally while changing its behavior behind the scenes.
ES6, also known as ECMAScript 2015, introduces many new features to JavaScript that allow for clearer, more concise code. Some major features include let and const for block scoping, arrow functions, classes, template strings, collections like Maps and Sets, and iterators and generators. New features like default parameters, rest/spread syntax, and destructuring make working with functions and arrays more flexible. Overall, ES6 enhances JavaScript's syntax and capabilities in many ways.
FITC events. For digital creators.
Save 10% off ANY FITC event with discount code 'slideshare'
See our upcoming events at www.fitc.ca
An Intro To ES6
with Grant Skinner
OVERVIEW
ECMAScript 6 is the approved and published standard for the next version of JavaScript. It offers new syntax and language features that provide new ways of tackling coding problems, and increase your productivity.
This session will introduce ES6 and delve into many of the new features of the language. It will also cover real-world use, including transpilers, runtimes, and browser support.
OBJECTIVE
Create confidence in evaluating and getting started using ES6.
TARGET AUDIENCE
JavaScript developers.
ASSUMED AUDIENCE KNOWLEDGE
JavaScript.
FOUR THINGS AUDIENCE MEMBERS WILL LEARN
Status of ES6
How to get started with ES6
ES6 feature overview
Practical considerations for adopting ES6
The document provides an agenda for a talk on modeling a Rubik's Cube in JavaScript. It begins with an introduction to scripting languages and ECMAScript. It then discusses modeling a Rubik's Cube by first walking through the code, then modeling the cube and finding moves to solve it. The document covers topics like scripting languages, ECMAScript, object-oriented programming concepts in JavaScript, and modeling a Rubik's Cube to be manipulated programmatically.
The document compares and contrasts features of the Scala and Ruby programming languages, including type systems, pattern matching, monkey patching, dynamic calls, traits/modules, and more. It discusses how each language handles the given features, often providing code examples, and notes similarities and differences between the two approaches. The overall assessment is that a draw is the best way to characterize the comparison between Scala and Ruby, as both languages have their merits for different use cases and preferences.
The document discusses the use of references in Perl programming. It describes how dispatch tables can be used to implement functions by storing references to functions in a hash and calling them via their keys. It also discusses higher-order functions, which are functions that can take other functions as arguments or return functions. The document provides examples of defining higher-order functions and passing function references between subroutines in Perl.
Python decorators allow functions and classes to be augmented or modified by wrapper objects. Decorators take the form of callable objects that process other callable objects like functions and classes. Decorators are applied once when a function or class is defined, making augmentation logic explicit and avoiding the need to modify call sites. Decorators can manage state information, handle multiple instances, and take arguments to customize behavior. However, decorators also introduce type changes and extra function calls that incur performance costs.
Programming Using Tcl/Tk
Tcl/Tk is a scripting language and widget toolkit. Tcl is used to write scripts and can be extended with C. Tk provides widgets to build graphical user interfaces. Simple programs in Tcl/Tk are easy to write, but more complex tasks are also possible. The language has no formal grammar but uses commands, variables, and substitutions to provide programming capabilities.
This document provides a history of JavaScript and ECMAScript specifications from 1995 to the present. It discusses the standardization process and key people and organizations involved like B. Eich, TC39, and ECMA. Major versions and proposed features are summarized, including ES6/ES2015 additions like arrow functions, block scoping with let/const, classes, modules, iterators/generators, and proxies.
This course provides you with skills to
* Develop sed and awk scripts
* Use sed and awk to automate common tasks
* Use sed and awk to create formatted reports
Prerequisites
* Basic understanding of UNIX / Linux Operating System
* Knowledge of basic UNIX / Linux commands
Intended Audience
* System Administrators, Testing Professionals, and Software Developers working in the UNIX / Linux environment
This document discusses JavaScript best practices for naming variables and functions, code formatting and style, scopes and closures, and class-like structures. It provides examples of how to use descriptive names, consistent formatting, closures to manage variable scopes, immediately invoked function expressions (IIFEs), and dataclass structures in Wakanda to define classes. Following these practices can improve code readability, maintainability and reduce bugs.
This is the third set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
Decorators in Python allow functions and methods to be modified by wrapping them in another callable object. Decorators provide a lightweight way to add reusable behavior to code. However, decorators can make functions difficult to test and introduce tight coupling. Alternatives like inheritance and mixins may provide a cleaner approach in some cases.
This is brief presentation on the Scala programming language. It is aimed at Java developers who are curious about Scala. It was given at a San Francisco Java User Group in January 2009.
This document provides an overview of several new features introduced in ECMAScript 6 (ES6), including:
1. Arrow functions which provide a shorter syntax for writing function expressions and retain the lexical this value.
2. Block scoping with let which allows block-level scoping of variables replacing the need for IIFEs in ES5. const is also introduced for single-assignment constants.
3. String templates which make it easier to construct strings and allow interpolation of variables and expressions.
This document provides an overview of ES6 features and how to set them up for use in Ruby on Rails applications. It describes key ES6 features such as let and const block scoping, template strings, destructuring assignment, default and rest parameters, loops and generators, enhanced object literals, Maps and Sets, arrow functions, modules, and classes. It then provides instructions for using the sprockets-es6 gem to transpile ES6 code to ES5 for use in Rails, as well as using Node.js and Gulp as an alternative approach.
This document summarizes new features introduced in ES2015 (ES6), including let and const block scoping, arrow functions, template literals, destructuring, classes, modules, and methods added to built-in objects like String, Array, Number, Math and more. It recommends using features like let, const, arrow functions, and template literals that improve code clarity and syntax, while being cautious of less supported features like iterators, generators and proxies that may require polyfills or have limited browser support. The document provides examples and explanations of many ES6 features and references additional learning resources.
Here are the slides that I gave for The Arizona Software Community meetup.
http://www.meetup.com/azsoftcom/events/222936544/
This was a gentle introduction to some of the features in EcmaScript 2015 and how and why you may use them.
This document provides an overview of ES6 (ECMAScript 2015) features including: let, const and var; template strings; arrow functions; destructuring; default parameters; rest and spread syntax; iterators; classes; modules; maps, sets, weakmaps and weaksets; promises; and more. It explains each feature and provides code examples to demonstrate usage and differences from ES5. Browser compatibility notes are also included to advise on safe usage of new features across environments.
This document provides an overview of an ES6 hackathon focusing on new features in ES6 including block scope, modules, destructuring, arrow functions, classes, template literals, internationalization, spread syntax, generators, sets, promises and more. Attendees will have 30 minutes to work on code challenges exploring these new ES6 features using resources like JSFiddle and TypeScript. The challenges involve updating functions to use new syntax like arrow functions, default parameters and object shorthand, satisfying class assertions, and improving outputs using template strings and internationalization.
The document provides a history of the ECMAScript specification from 1995 to 2015. It outlines the major releases and additions to the language over time including ES3.1, ES5, ES6, and the ongoing development of future versions. Key changes include the introduction of classes, modules, arrow functions, promises, generators, and more robust collection types like Sets and Maps. The specification is developed by the TC39 committee group within Ecma International.
The document provides an overview of ECMAScript 6 (ES6) and Asynchronous Module Definition (AMD). It discusses features of ES6 like constants, block scoping, arrow functions, classes, and generators. It also covers using AMD modules with AngularJS and demonstrates importing and exporting modules. The presentation aims to introduce developers to ES6 and show how to use AMD modules with AngularJS applications.
Game Design and Development Workshop Day 1Troy Miles
This course teaches you how to build awesome video games using Cocos2Dx. Cocos2Dx is a feature packed, free game development engine. It is cross platform, high performance, and supports three languages: C++, Lua and JavaScript. With it, you can write games for iOS, Android, Windows, Mac, and the Web. It is nothing short of amazing and this course teaches you how to use it. We will program Cocos2Dx in JavaScript, but this is not a programming class. If you don't know how to write code in JavaScript or some other curly brace language, this is not the course for you. For those whose JavaScript is rusty, we will do quick language overview. Don't let the JavaScript part fool you. Cocos2Dx is built from highly optimized C++ and OpenGL, JavaScript is used for game logic, not graphics. Our games will run at a super fast, 60 frames a second.
Sperasoft talks about several important aspects of ECMAScript6 - language widely used for client-side scripting on the web, in the form of several well-known implementations such as JavaScript, JScript and ActionScript.
Slides from my talk at the Feb 2011 Seattle Tech Startups meeting. More info here (along with powerpoint slides): http://www.startupmonkeys.com/2011/02/scala-frugal-mechanic/
This document provides a summary of new features in JavaScript, including let/const block scoping, arrow functions, template strings, classes, generators, async/await, and more. It explains each feature in 1-3 sentences and includes code examples.
This document summarizes the key new features being introduced in ECMAScript 6 (ES6), also known as Harmony. Some of the major additions include block scope with let and const, classes and modules, iterators and generators, arrow functions, and parameter handling improvements with rest/spread. ES6 is designed to be backwards compatible with ES5 while adding new functionality. Many new features are already being implemented in modern browsers and Node.js using flags or alternative syntax like --harmony for testing purposes today.
The fundamentals and advance application of Node will be covered. We will explore the design choices that make Node.js unique, how this changes the way applications are built and how systems of applications work most effectively in this model. You will learn how to create modular code that’s robust, expressive and clear. Understand when to use callbacks, event emitters and streams.
Explaining ES6: JavaScript History and What is to ComeCory Forsyth
An overview of some of the history of JavaScript, how it became ECMAScript (and what Ecma is), as well as highlights of the new features and syntax in ES6 aka ES2015.
Originally presented to the New York Public Library on June 4 2015.
The document summarizes the key features of ES6 (ECMAScript 2015), the next version of JavaScript. It discusses new features like block scoping with let and const, arrow functions, classes, enhanced object literals, template strings, and promises. It also covers iterators and generators, which allow iterable objects to be looped over and asynchronous code to be written more cleanly. The presentation provides examples to illustrate how developers can take advantage of these new language features in their code.
This document provides an overview of JavaScript for PHP developers. It compares the syntax and core concepts between the two languages. Some of the key points covered include: variables and data types are similar, functions are objects in JavaScript, JavaScript uses prototypes instead of classes, and functions provide scope. The document also summarizes the built-in global functions and properties, common methods for objects like Array and String, and emphasizes that constructor functions are often not needed in JavaScript.
“An Outlook of the Ongoing and Future Relationship between Blockchain Technologies and Process-aware Information Systems.” Invited talk at the joint workshop on Blockchain for Information Systems (BC4IS) and Blockchain for Trusted Data Sharing (B4TDS), co-located with with the 36th International Conference on Advanced Information Systems Engineering (CAiSE), 3 June 2024, Limassol, Cyprus.
Best 20 SEO Techniques To Improve Website Visibility In SERPPixlogix Infotech
Boost your website's visibility with proven SEO techniques! Our latest blog dives into essential strategies to enhance your online presence, increase traffic, and rank higher on search engines. From keyword optimization to quality content creation, learn how to make your site stand out in the crowded digital landscape. Discover actionable tips and expert insights to elevate your SEO game.
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-und-domino-lizenzkostenreduzierung-in-der-welt-von-dlau/
DLAU und die Lizenzen nach dem CCB- und CCX-Modell sind für viele in der HCL-Community seit letztem Jahr ein heißes Thema. Als Notes- oder Domino-Kunde haben Sie vielleicht mit unerwartet hohen Benutzerzahlen und Lizenzgebühren zu kämpfen. Sie fragen sich vielleicht, wie diese neue Art der Lizenzierung funktioniert und welchen Nutzen sie Ihnen bringt. Vor allem wollen Sie sicherlich Ihr Budget einhalten und Kosten sparen, wo immer möglich. Das verstehen wir und wir möchten Ihnen dabei helfen!
Wir erklären Ihnen, wie Sie häufige Konfigurationsprobleme lösen können, die dazu führen können, dass mehr Benutzer gezählt werden als nötig, und wie Sie überflüssige oder ungenutzte Konten identifizieren und entfernen können, um Geld zu sparen. Es gibt auch einige Ansätze, die zu unnötigen Ausgaben führen können, z. B. wenn ein Personendokument anstelle eines Mail-Ins für geteilte Mailboxen verwendet wird. Wir zeigen Ihnen solche Fälle und deren Lösungen. Und natürlich erklären wir Ihnen das neue Lizenzmodell.
Nehmen Sie an diesem Webinar teil, bei dem HCL-Ambassador Marc Thomas und Gastredner Franz Walder Ihnen diese neue Welt näherbringen. Es vermittelt Ihnen die Tools und das Know-how, um den Überblick zu bewahren. Sie werden in der Lage sein, Ihre Kosten durch eine optimierte Domino-Konfiguration zu reduzieren und auch in Zukunft gering zu halten.
Diese Themen werden behandelt
- Reduzierung der Lizenzkosten durch Auffinden und Beheben von Fehlkonfigurationen und überflüssigen Konten
- Wie funktionieren CCB- und CCX-Lizenzen wirklich?
- Verstehen des DLAU-Tools und wie man es am besten nutzt
- Tipps für häufige Problembereiche, wie z. B. Team-Postfächer, Funktions-/Testbenutzer usw.
- Praxisbeispiele und Best Practices zum sofortigen Umsetzen
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
In the rapidly evolving landscape of technologies, XML continues to play a vital role in structuring, storing, and transporting data across diverse systems. The recent advancements in artificial intelligence (AI) present new methodologies for enhancing XML development workflows, introducing efficiency, automation, and intelligent capabilities. This presentation will outline the scope and perspective of utilizing AI in XML development. The potential benefits and the possible pitfalls will be highlighted, providing a balanced view of the subject.
We will explore the capabilities of AI in understanding XML markup languages and autonomously creating structured XML content. Additionally, we will examine the capacity of AI to enrich plain text with appropriate XML markup. Practical examples and methodological guidelines will be provided to elucidate how AI can be effectively prompted to interpret and generate accurate XML markup.
Further emphasis will be placed on the role of AI in developing XSLT, or schemas such as XSD and Schematron. We will address the techniques and strategies adopted to create prompts for generating code, explaining code, or refactoring the code, and the results achieved.
The discussion will extend to how AI can be used to transform XML content. In particular, the focus will be on the use of AI XPath extension functions in XSLT, Schematron, Schematron Quick Fixes, or for XML content refactoring.
The presentation aims to deliver a comprehensive overview of AI usage in XML development, providing attendees with the necessary knowledge to make informed decisions. Whether you’re at the early stages of adopting AI or considering integrating it in advanced XML development, this presentation will cover all levels of expertise.
By highlighting the potential advantages and challenges of integrating AI with XML development tools and languages, the presentation seeks to inspire thoughtful conversation around the future of XML development. We’ll not only delve into the technical aspects of AI-powered XML development but also discuss practical implications and possible future directions.
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
Infrastructure Challenges in Scaling RAG with Custom AI modelsZilliz
Building Retrieval-Augmented Generation (RAG) systems with open-source and custom AI models is a complex task. This talk explores the challenges in productionizing RAG systems, including retrieval performance, response synthesis, and evaluation. We’ll discuss how to leverage open-source models like text embeddings, language models, and custom fine-tuned models to enhance RAG performance. Additionally, we’ll cover how BentoML can help orchestrate and scale these AI components efficiently, ensuring seamless deployment and management of RAG systems in the cloud.
How to Get CNIC Information System with Paksim Ga.pptxdanishmna97
Pakdata Cf is a groundbreaking system designed to streamline and facilitate access to CNIC information. This innovative platform leverages advanced technology to provide users with efficient and secure access to their CNIC details.
Communications Mining Series - Zero to Hero - Session 1DianaGray10
This session provides introduction to UiPath Communication Mining, importance and platform overview. You will acquire a good understand of the phases in Communication Mining as we go over the platform with you. Topics covered:
• Communication Mining Overview
• Why is it important?
• How can it help today’s business and the benefits
• Phases in Communication Mining
• Demo on Platform overview
• Q/A
UiPath Test Automation using UiPath Test Suite series, part 6DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 6. In this session, we will cover Test Automation with generative AI and Open AI.
UiPath Test Automation with generative AI and Open AI webinar offers an in-depth exploration of leveraging cutting-edge technologies for test automation within the UiPath platform. Attendees will delve into the integration of generative AI, a test automation solution, with Open AI advanced natural language processing capabilities.
Throughout the session, participants will discover how this synergy empowers testers to automate repetitive tasks, enhance testing accuracy, and expedite the software testing life cycle. Topics covered include the seamless integration process, practical use cases, and the benefits of harnessing AI-driven automation for UiPath testing initiatives. By attending this webinar, testers, and automation professionals can gain valuable insights into harnessing the power of AI to optimize their test automation workflows within the UiPath ecosystem, ultimately driving efficiency and quality in software development processes.
What will you get from this session?
1. Insights into integrating generative AI.
2. Understanding how this integration enhances test automation within the UiPath platform
3. Practical demonstrations
4. Exploration of real-world use cases illustrating the benefits of AI-driven test automation for UiPath
Topics covered:
What is generative AI
Test Automation with generative AI and Open AI.
UiPath integration with generative AI
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceIndexBug
Imagine a world where machines not only perform tasks but also learn, adapt, and make decisions. This is the promise of Artificial Intelligence (AI), a technology that's not just enhancing our lives but revolutionizing entire industries.
Maruthi Prithivirajan, Head of ASEAN & IN Solution Architecture, Neo4j
Get an inside look at the latest Neo4j innovations that enable relationship-driven intelligence at scale. Learn more about the newest cloud integrations and product enhancements that make Neo4j an essential choice for developers building apps with interconnected data and generative AI.
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2024/06/building-and-scaling-ai-applications-with-the-nx-ai-manager-a-presentation-from-network-optix/
Robin van Emden, Senior Director of Data Science at Network Optix, presents the “Building and Scaling AI Applications with the Nx AI Manager,” tutorial at the May 2024 Embedded Vision Summit.
In this presentation, van Emden covers the basics of scaling edge AI solutions using the Nx tool kit. He emphasizes the process of developing AI models and deploying them globally. He also showcases the conversion of AI models and the creation of effective edge AI pipelines, with a focus on pre-processing, model conversion, selecting the appropriate inference engine for the target hardware and post-processing.
van Emden shows how Nx can simplify the developer’s life and facilitate a rapid transition from concept to production-ready applications.He provides valuable insights into developing scalable and efficient edge AI solutions, with a strong focus on practical implementation.
3. A Brief History of Time...A Brief History of Time...
Official name of the language is ECMAScript
ECMA is the Standardizations Body
TC39 is the committee working on the
standards.
in 2015, ECMA decided to do yearly standards,
hence the renaming.
4. ES6 Browser SupportES6 Browser Support
Current browser support for ES6 is great on the desktop -
not so much elsewhere
http://kangax.github.io/compat-table/es6/
Current development uses ES6/next features
through the use of transpilers like Babel
5. Arrow FunctionsArrow Functions
Arrows are a function shorthand using the => syntax. They are
syntactically similar to the related feature in C#, Java 8 and
CoffeeScript. They support both expression and statement
bodies. Unlike functions, arrows share the same lexical this as
their surrounding code.
6. Arrow Functions
var list = [1,2,3,4,5];
list.map(function(n) {
return n * 2;
}, this);
list.map(function(n) {
return n * 2;
}.bind(this));
In ES5, retaining the context of this in function expressions
was typically done via Function#bind(); or through passing an
execution context those few standard functions that allowed
one.
var list = [1,2,3,4,5];
list.map(n => n * 2);
ES5ES5 ES6ES6
8. Block ScopingBlock Scoping
Block-scoped binding constructs. let is the new var.
const is single-assignment. Static restrictions
prevent use before assignment.
9. Block Scoping
var a = 5;
var b = 10;
if (a === 5) {
// IIFE !!!
(function () {
var a = 4;
b = 1;
console.log(a); // 4
console.log(b); // 1
})();
}
console.log(a); // 5
console.log(b); // 1
ES5 required IIFEs in order to create pseudo-block scoping.
ES6 gives us let, which is scoped to the enclosing block.
var a = 5;
var b = 10;
if (a === 5) {
let a = 4; // scope inside if-block
var b = 1; // scope inside function
console.log(a); // 4
console.log(b); // 1
}
console.log(a); // 5
console.log(b); // 1
ES5ES5 ES6ES6
10. Block Scoping
// define as a non-writable `constant`
// and give it a value
Object.defineProperties(window, {
pi: {
value: 3.14159265359,
enumerable: true,
writable: false
}
});
// var pi = 7;
// Attempt to overwrite the constant
pi = 15;
console.log('Slice of pi: ' + pi);
// 3.14159265359
const pi = 3.14159265359;
// Attempt to overwrite the constant
pi = 15;
// TypeError: Assignment to constant
console.log('Slice of pi: ' + pi);
// 3.14159265359
// Never executes...
ES5ES5 ES6ES6
11. String TemplatesString Templates
Template strings provide syntactic sugar for constructing
strings. This is similar to string interpolation features in
Perl, Python and more. Optionally, a tag can be added to
allow the string construction to be customized, avoiding
injection attacks or constructing higher level data
structures from string contents.
12. String Templates
var name = 'Dan';
var dan = {
projects: ['redux','react-dnd']
};
// concatenation
console.log(name + ' Abramov');
//=> Dan Abramov
// joining
console.log(
['Known for ', dan.projects[0]].join('')
);
//=> Known for redux
ES5 had nothing similar. You would just concatenate strings
with expressions. ES6 allows interpolation of variables,
expressions and functions inside template strings.
ES5ES5
13. String Templates
const name = 'Dan';
const n = 10;
const dan = {
projects: ['redux','react-dnd']
};
const fn = () => 'reducers';
// variables
console.log(`${name} Abramov`);
// objects
console.log(`Known for ${dan.projects[0]}`);
// expression interpolation
console.log(`${n} + 2 = ${n + 2}`);
// functions
console.log(`I love ${fn()}`);
ES6ES6
14. String Templates
// Multiline strings
// 1. escaping - white space retained
// 2. concatenation
console.log(
'This string spans n
multiple lines. It's crazy!n' +
'It's a bit harder to read'
);
//=> This string spans
//=> multiple lines. It's crazy!
//=> It's a bit harder to read
ES5ES5
// Multiline strings
// - white space retained
console.log(
`This string spans
multiple lines. It's crazy!`
);
//=> This string spans
//=> multiple lines. It's crazy!
ES6ES6
15. Object PropertiesObject Properties
Object Initializer Shorthand
Object Method Assignment
Computed Properties
Object literals are extended to support setting the
prototype at construction, shorthand for foo: foo
assignments, defining methods and making super calls.
Together, these also bring object literals and class
declarations closer together, and let object-based design
benefit from some of the same conveniences.
16. Object Properties
function getPoint() {
var x = 1;
var y = 10;
return { x: x, y: y };
}
getPoint();
//=> { x: 1, y: 10 }
With property shorthand notation, if the property name and
value variable are the same, no need to repeat yourself.
function getPoint() {
var x = 1;
var y = 10;
return { x, y };
}
getPoint()
//=> { x: 1, y: 10 }
ES5ES5 ES6ES6
17. Object Properties
var object = {
value: 42,
toString: function toString() {
return this.value;
}
};
object.toString() === 42;
// -> true
With object method assignment shorthand you can shorten
method declarations on objects/classes as well.
var object = {
value: 42,
toString() {
return this.value;
}
};
console.log(object.toString() === 42);
// -> true
ES5ES5 ES6ES6
18. Object Properties
var prefix = 'foo';
var obj = {};
obj[prefix + 'bar'] = 'hello';
obj[prefix + 'baz'] = 'world';
console.log(obj['foobar']);
// -> hello
console.log(obj['foobaz']);
// -> world
With ES6 we now have the ability to use computed property
names as well. You can evaluate any expression within [ ].
var foo = 'foo';
var fn = () => 'foo';
var obj = {
[foo + 'bar']: 'hello',
[fn() + 'baz']: 'world'
};
console.log(obj['foobar']);
// -> hello
console.log(obj['foobaz']);
// -> world
ES5ES5 ES6ES6
19. Destructuring AssignmentsDestructuring Assignments
Destructuring allows binding using pattern matching,
with support for matching arrays and objects.
Destructuring is fail-soft, similar to standard object
lookup foo["bar"], producing undefined values when not
found.
20. Destructuring
var foo = { bar: 'Kyle', baz: 'Simpson' };
var bar = foo[bar];
var baz = foo[baz];
// -> bar: 'Kyle', baz 'Simpson'
var list = [1,2,3];
var one = list[0];
var two = list[1];
var three = list[2];
// -> one: 1, two: 2, three: 3
Binds the values from one Array or Object to another.
const foo = { bar: 'Kyle', baz: 'Simpson' };
const {bar, baz} = foo;
// -> bar: 'Kyle', baz 'Simpson'
const list = [1,2,3];
const [one, two, three] = list;
// -> one: 1, two: 2, three: 3
ES5ES5
ES6ES6
21. Destructuring
You can also map destructured objects to aliases as well.
const foo = { bar: 'Kyle', baz: 'Simpson' };
const { bar: a, baz: b } = foo;
// -> bar: 'Kyle', baz 'Simpson'
ES6ES6
22. Destructuring
Or even pull out deeply nested properties
const person = {
name: 'Steve',
things: { one: 1, two: 2 },
years: [1975, 1995, 2015]
};
const { name, things: { one }} = person;
// -> name: Steve
// -> one: 1
// But, if it's not there
const stuff = { one: 1, two: 2 };
const { three } = stuff;
// -> three: undefined
ES6ES6
23. Destructuring
Plus, it makes it easier to do things like swapping variables
without using an auxiliary. Or pulling out properties
dynamically using computed property names.
let a = 10, b = 20;
[a, b] = [b, a];
// -> a = 20, b = 10
const key = 'doge';
const { [key]: foo } = { doge: 'such bar!' };
// -> foo = such bar!
// Assign defaults (in case of undefined)
const wow = { such: 'awesome' };
const { much='missing' } = wow;
// -> much = missing
// Skip over elements in arrays
let [,,c,d] = [1,2,3,4,5];
// -> c = 3
// -> d = 4
ES6ES6
24. Function ArgumentsFunction Arguments
Default Arguments
Spread
Rest
Callee-evaluated default parameter values. Turn
an array into consecutive arguments in a function
call. Bind trailing parameters to an array. Rest
replaces the need for arguments and addresses
common cases more directly.
25. Default Argument Values
function iam(name) {
(name === undefined) && (name="Batman");
console.log("I am " + name + '!');
}
iam();
// -> I am Batman!
Similar to the default assignments used in destructuring,
functions allow you assign default values as well. If the
parameter passed is undefined, it gets the default.
function iam(name="batman") {
console.log(`I am ${name}!`);
}
iam();
// -> I am Batman!
ES5ES5
ES6ES6
26. Defaults & Destructuring
You can even use destructuring and defaults on function
arguments
function random ({ min=1, max=300 }) {
return Math.floor(Math.random() * (max - min)) + min;
}
random({});
// -> 174
random({max: 24});
// -> 18
// Or, make the whole argument optional
function random ({ min=1, max=300 }={}) {
return Math.floor(Math.random() * (max - min)) + min;
}
random();
// -> 133
ES6ES6
27. The spread operator pulls individual items out of a collection
(Array or Object).
function reducer(state={}, action) {
switch(action.type) {
case 'SET_AGE': return {
...state,
age: action.age
};
default:
return state;
}
}
const state = { name: 'Dave', age: 40 };
const action = {
type: 'SET_AGE',
age: 41
};
reducer(state, action);
// -> { name: 'Dave', age: 41 }
ES6ES6
... spread operator
28. var nums = [4,1,9,5];
Math.max.apply(null, nums);
// -> 9
let a = [1,2,3];
let b = [4,5,6];
// join
var c = a.concat(b);
// -> c = [1,2,3,4,5,6]
// copy
var d = [].slice.call(c, 0);
// -> d = [1,2,3,4,5,6]
// splice
var e = [0,7,8];
var f = e.slice(0,1)
.concat(c, e.slice(1), [9,10]);
// -> f = [0,1,2,3,4,5,6,7,8,9,10]
Works with Arrays as well (non-mutating).
let nums = [4,1,9,5];
Math.max(...nums);
// -> 9
let a = [1,2,3];
let b = [4,5,6];
// join
let c = [...a, ...b];
// -> c = [1,2,3,4,5,6]
// copy
let d = [...c];
// -> d = [1,2,3,4,5,6]
// splice
let e = [0, ...d, 7, 8, ...[9,10]];
// -> e = [0,1,2,3,4,5,6,7,8,9,10]
ES5ES5 ES6ES6
... spread operator
29. function join(sep /*, ...args*/) {
var args = [].slice.call(arguments, 1);
return args.join(sep);
}
join(', ', 'john', 'bobby', 'ted')
// -> 'john, bobby, ted'
The rest operator (or, gather) allows us to pull values into a
collection Array or Object.
const join = (sep, ...args) => args.join(sep);
join(':', "one", "two", "three");
// -> one:two:three
ES5ES5
ES6ES6
... rest operator
30. You can even use it with destructuring to gather values.
var list = [1,2,3,4,5];
var [head, ...tail] = list;
// -> head = 1
// -> tail = [2,3,4,5]
var list = [1,2,3,4,5];
var [head, ...tail] = list;
console.log(head, tail);
var passed = {
className: 'panel',
style: { color: '#369'},
title: 'Panel',
active: true
};
var { className, style, ...props } = passed;
// -> className = 'panel'
// -> styles = { color: '#369' }
// -> props = { title: 'Panel', active: true }
ES6ES6
... rest operator
31. Iterators & ArraysIterators & Arrays
Iterators allow us to traverse a collection. Generalize for..in
to custom iterator-based iteration with for..of. Array#from
allows us to convert array-like collections into real arrays.
32. Iterators & Arrays
var a = [1,2,3];
a.forEach(function (element) {
console.log(element);
});
// -> 1 2 3
// Using a for loop
var a = [1,2,3];
for (var i = 0; i < a.length; ++i) {
console.log(a[i]);
}
// -> 1 2 3
// Uses an iterator behind the scenes
for (let element of [1, 2, 3]) {
console.log(element);
}
// => 1 2 3
ES5ES5
ES6ES6
33. Iterators
function iteratorFor(list) {
var i = 0;
return {
next: function() {
return {
value: list[i++],
done: i > list.length
};
}
}
}
var iter = iteratorFor([1,2,3]);
var res = iter.next();
while (!res.done) {
console.log(res);
res = iter.next();
}
// -> Same output as right-side
What is an iterator? ES6 let's us access them via predefined
Symbol properties.
let iter = [1, 2, 3][Symbol.iterator]();
console.log(iter.next());
// -> {value: 1, done: false}
console.log(iter.next());
// -> {value: 2, done: false}
console.log(iter.next());
// -> {value: 3, done: false}
console.log(iter.next());
// -> {value: undefined, done: true}
ES5ES5 ES6ES6
34. Iterators with Generators
You can write your own iterators using ES6 generator
functions and yield.
function* iteratorFor(list) {
for (let item of list) {
yield item;
}
}
const iter = iteratorFor([1,2,3]);
for (let value of iter) {
console.log(value);
}
// -> 1 2 3
// can't use iter again
let iter2 = iteratorFor([1,2,3]);
console.log([...iter2]);
// -> [1,2,3]
ES6ES6
35. ClassesClasses
ES2015 classes are a simple sugar over the
prototype-based OO pattern. Having a single,
convenient, declarative form makes class patterns
easier to use, and encourages interoperability.
Classes support prototype-based inheritance, super
calls, instance and static methods and constructors.
36. // Person "Class"
function Person(name) {
this.name = name;
}
Person.type = 'person';
Person.prototype.greet = function() {
return 'Hello, my name is ' + this.name + '.';
}
Person.prototype.typeOf = function() {
return this.constructor.type;
}
// Employee "Class"
function Employee(company, name) {
Person.call(this, name);
this.company = company;
}
Employee.type = 'employee';
// setup inheritance via prototype chain
Employee.prototype = Object.create(Person.prototype);
Employee.prototype.constructor = Employee;
// Override greet method
Employee.prototype.greet = function() {
return Person.prototype.greet.call(this) +
' I work at ' + this.company
}
ES5ES5
37. ES5 "Classes"
// create an instance
var Dave = new Employee('OCI', 'David');
// call a method
Dave.greet();
// -> Hello, my name is David. I work at OCI
// access "static" property via method
console.log('Dave is an ' + Dave.typeOf());
// -> Dave is an employee
ES5ES5
38. ES6 Classes
class Person {
static type = 'person';
constructor(name) {
this.name = name;
}
typeOf() { return this.constructor.type; }
greet() { return `Hello, my name is ${this.name}`; }
}
class Employee extends Person {
static type = 'employee';
constructor(company, name) {
super(name);
this.company = company;
}
greet() {
return `${super.greet()}. I work at ${this.company}`;
}
}
ES6ES6
39. ES6 Classes
// create an instance
const Dave = new Employee('OCI', 'David');
// invoke methods
console.log(Dave.greet());
// -> Hello, my name is David. I work at OCI
// access static props via method
console.log(`Dave is an ${Dave.typeOf()}`);
// -> employee
ES6ES6
40. ModulesModules
import & export
named exports
default exports
importing defaults & named exports
Language-level support for modules for component
definition. Codifies patterns from popular JavaScript
module loaders (AMD, CommonJS). Runtime behaviour
defined by a host-defined default loader. Implicitly async
model – no code executes until requested modules are
available and processed.
41. Module Styles
// app.js
var math = require('lib/math');
math.sum(math.pi, math.pi);
Currently, the module loading spec is not defined completely and not
implemented in any engine. Node supports CommonJS; but other
async loading module formats exist like AMD and UMD.
// app.js
import math from 'lib/math';
math.sum(math.pi, math.pi)
ES5ES5 ES6ES6
// lib/math.js
exports.sum = sum;
function sum(x, y) {
return x + y;
}
var pi = exports.pi = 3.141593;
ES5ES5
// lib/math.js
export function sum(x, y) {
return x + y;
}
export var pi = 3.141593;
ES6ES6
42. Named & Default Exports
// Named exports
function sum(a,b) {
return a + b;
}
exports.sum = sum;
function div(a,b) {
return a / b;
}
exports.div = div;
// Module 'default' export
exports['default'] = function(n) {
return n * n;
}
module.exports = Object.assign(
exports['default'],
exports
);
Both CommonJS and ES6 allow for named exports and a
"default" export.
// Named exports
export sum = (a,b) => a + b;
export div = (a,b) => a / b;
// default export
export default (n) => n * n;
ES5ES5 ES6ES6
43. ES6 Modules
You can only have 1 default export per module. But you can
import the default or named exports in a number of ways.
// lib/math.js
// named exports
export const sqrt = Math.sqrt;
export function square(x) {
return x * x;
}
export function diag(x, y) {
return sqrt(square(x) + square(y));
}
// default export
export default function(...nums) {
return Math.max(...nums);
}
ES6ES6
import max from 'lib/math';
max(1,2,3); // -> 3
import { square, diag } from 'lib/math';
square(2) // -> 4
diag(2,4) // -> 4.47213595499958
import max, { square, sqrt } from 'lib/math';
max(3,1,5); // -> 5
square(4); // -> 16
sqrt(9); // -> 3
ES6ES6