JavaScript: The Language Andrew Miadowicz Program Manager DEV307.

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

the javascript language BY SA.
Intro to JavaScript. JavaScript History Client (generally browser-side) language invented at Netscape under the name LiveScript around 1995 Netscape wanted.
ECMAScript 5: The New Parts Level 7. Complete implementations of ECMAScript, Fifth Edition, are now in the best web browsers. Including IE10.
I just met you, and 'this' is crazy, but here's my NaN, so call(me) maybe? JavaScript is so weird.
Javascript Client-side scripting. Up to now  We've seen a little about how to control  content with HTML  presentation with CSS  Javascript is a language.
OBJECTS MIT-AITI copyright Introduction Object and Properties Constructors and Methods Prototypes and Inheritance Object-Oriented JavaScript Objects.
JAVASCRIPT Introduction Kenny Lam. What is Javascript?  Client-side scripting language that can manipulate elements in the DOM  Event-driven language.
Top 10 Production Experiences with Service Manager and Orchestrator Nathan Lasnoski Infrastructure Architect Microsoft MVP Concurrency.
What is a “modern” application? Ulrich (Uli) Homann Chief Architect, Microsoft Services Microsoft Corporation.
Taking JavaScript Seriously IS NOT THE WORST IDEA.
Programming Games Computer science big ideas. Computer Science jargon. Show virtual dog Homework: [Catch up: dice game, credit card or other form.] Plan.
Building Metro style UIs Paul Gusmorino Lead Program Manager Microsoft Corporation DEV354.
Chapter 6 JavaScript and AJAX. Objectives Explain the purpose and history of JavaScript Describe JavaScript features Explain the event-driven nature of.
JavaScript JavaScript is a scripting language that is most commonly used to add client- side programming to a web page. Some of the things it is used for.
Building Metro style apps with HTML and JavaScript Paul Gusmorino Lead Program Manager Microsoft Corporation.
JavaScript Lecture 6 Rachel A Ober
1 JavaScript. 2 What’s wrong with JavaScript? A very powerful language, yet –Often hated –Browser inconsistencies –Misunderstood –Developers find it painful.
Visual Studio Tips & Tricks Dustin Campbell Microsoft Corporation Scott Cate EventDay.com DEV319.
JavaScript davide morelli history LiveScript (1995) in Netscape java script is a misleading name started as a scripting counterpart.
Advanced Microsoft SharePoint 2010 Upgrade Troubleshooting Todd Klindt SharePoint Nerd Rackspace OSP339.
Introduction to JavaScript Gordon Tian
CHAPTER 4 Java Script อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Using Client-Side Scripts to Enhance Web Applications 1.
Object Oriented JavaScript. JavaScript Really only 4 types in JavaScript – number, string, boolean – Object (includes arrays) Remember that an object.
DEV411 Testing Un-Testable Code with Visual Studio 2012 Fakes Peter Provost Sr. Program Manager Lead Microsoft Corporation DEV411.
App Controller Richard Rundle Ketan Ghelani Program Managers Microsoft Corporation MGT303.
Introduction to Programming (in JavaScript) in 10 minutes …hopefully Else.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
JavaScript Best Practices Learn How to Write Better Quality JavaScript Software University Technical Trainers SoftUni Team.
Martin Kruliš by Martin Kruliš (v1.0)1.
ECMAScript 3.1 Object Model Allen Wirfs-Brock Microsoft.
Prototypal Inheritance. Can We Do Inheritance Without Classes? How do we share behaviour across objects.
1 Iterative Statements Repeated execution of a (compound) statement by iteration or recursion –Iteration is statement level –Recursion is unit-level control.
CNIT 133 Interactive Web Pags – JavaScript and AJAX Objects.
OSP201: Creating Self- Service BI Solutions with SharePoint Server 2010 Peter Myers.
MASTERING NAMESPACES! Илья Кантор EcmaScript 5.
Application Lifecycle Management Tools for C++ in Visual Studio 2012 Rong Lu Program Manager Visual C++ Microsoft Corporation DEV316.
Introduction to Web Frontend Development with JavaScript.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Variables.
1 Javascript CS , Spring What is Javascript ? Browser scripting language  Dynamic page creation  Interactive  Embedded into HTML pages.
MIT-AITI: Functions Defining and Invoking Functions Functions as Data Function Scope: The call Object Function Arguments: The arguments objects Function.
JavaScript and Ajax (Control Structures) Week 4 Web site:
What web developers need to know when building Metro style apps Scott Dickens Principal Program Manager Lead Microsoft Corporation DEV352.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
Copyright By Free for non-commercial use. Editable provided that the copyright claim is included.
JavaScript Syntax Fort Collins, CO Copyright © XTR Systems, LLC Introduction to JavaScript Syntax Instructor: Joseph DiVerdi, Ph.D., MBA.
JavaScript Best Practices Learn How to Write Better Quality JavaScript Software University Technical Trainers SoftUni Team.
Making Agile Estimation Work Joel Semeniuk and Stephen Forte Microsoft Corporation AAP309.
Going Beyond F11: Debug Better and Faster with Visual Studio 2012 Brian A. Randell Senior Consultant MCW Technologies DEV317.
Building Metro style apps with XAML with.NET Tim Heuer Program Manager Microsoft Corporation DEV353.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
ActionScript Programming Help
Web Systems & Technologies
JavaScript: Good Practices
JavaScript for C++ and Java Programmers
Modern JavaScript Luke Hoban Program Manager — JavaScript
Juriy Bura
12/1/2018 9:33 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
JavaScript: The Language
Modern JavaScript Develop And Design
CS5220 Advanced Topics in Web Programming JavaScript Basics
2017, Fall Pusan National University Ki-Joune Li
University of Kurdistan
JavaScript Reserved Words
CS5220 Advanced Topics in Web Programming Node.js Basics
CS3220 Web and Internet Programming JavaScript Basics
CS3220 Web and Internet Programming JavaScript Basics
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Presentation transcript:

JavaScript: The Language Andrew Miadowicz Program Manager DEV307

JavaScript

ECMAScript is just a funny name for JavaScript

C-style syntax but not a whole lot of it function everything() { var x = {a:10}, y = [1,2], z = function() { }; for(var p in x) { lbl: for(var i = 0; i < 10; i++) { switch(x[p]) { case 0: continue; default: break lbl; } if(x instanceof String || 'a' in x) delete x.a; } while(typeof true) { if(void false) { this.x = 3 / (-this.f()) ? /foo/g : new String("hello") } else { do { try { throw 3; } catch(e) { debugger; return; } finally {}} while(false); }

Objects are bags of properties var o1 = {}; o1.x = 3; o1.x = 4; var o2 = { x : 3 }; var o3 = { first: o2, second: function() { return 5; } } o2.x === 3; o2["x"] === 3; o2["the answer!"] = 42;

Objects have prototypes var o1 = { }; o1.valueOf() === "[object Object]" var o2 = {valueOf: function() { return 10; }}; o2.valueOf() === 10

Objects inherit from other objects var point2d = { x:10, y:20 }; var point3d = Object.create(point2d); point3d.z = 30; var location = Object.create(point2d); location.name = "Mandalay Bay"

// Data Property var bankAccount = { balance: 1257 } // Accessor Property var bankAccount2 = { get balance() { return 1257; } set balance(v) { }; }

Objects have a descriptor associated with each property Data Descriptor: { value : 47, writable : false, enumerable : true, configurable : true } Accessor Descriptor: { get : function location() { }, set : function location() { }, enumerable : true, configurable : true }

Objects new ES5 object reflection APIs var desc = Object.getOwnPropertyDescriptor(obj, name) Object.defineProperty(obj, name, desc) var names = Object.getOwnPropertyNames(obj) var protoObj = Object.getPrototypeOf(obj)

demo Accessor Properties Object.getOwnPropertyDescriptor Object.defineProperty Objects, Properties and the DOM

Objects key ideas

Functions are first-class values function sum(x, y) { return x + y; } var sum2 = function(x, y) { return x + y; } var sum3 = sum; function wrap(f) { return f(); } wrap(function() { return 5; })

Functions are objects function sum(x, y) { return x + y; } sum.length === 2; Object.getPrototypeOf(sum) === Function.prototype;

Functions have special rules for ‘this’ var obj = { sum: function(x,y) { return x + y; } } obj.sum(3,4); var obj2 = { offset: 7; sum: function(x,y) { return x + y + this.offset; } } obj2.sum(3,4) === 14; var f = obj2.sum; f(3,4) === NaN; f.call(obj2, 3, 4); f.apply(obj2, [3, 4]);

Functions have special behaviour when invoked with ‘new’ function Person(firstName,lastName) { this.firstName = firstName; this.lastName = lastName; } var bob = new Person("Bob", "Crites"); var anil = new Person("Anil", "Madhavan"); bob.firstName === "Bob"; Person.prototype.getFullName = function() { return this.firstName + " " + this.lastName; } bob.getFullName() === "Bob Crites"

Functions objects and prototypes and constructors, oh my! bob.firstName === "Bob"; bob.getFullName() === "Bob Crites"; anil.getFullName === bob.getFullName;

Functions objects and prototypes and constructors, oh my! bob instanceof Person Person.prototype.getFullName = function() {... }; new (bob.constructor)("Cynthia", "Washington")

Functions objects and prototypes and constructors, oh my! bob.valueOf() Person.valueOf()

Functions objects and prototypes and constructors, oh my!

demo Constructors and ‘new’ HTML element inheritance Constructors and the DOM

Functions have their own variable scopes // Scope (function() { var x = 5; x === 5; })(); x === undefined // Outer variable access var outer = "hello"; (function() { outer = "goodbye"; })(); outer === "goodbye"; // Isolating from changes in outer variables var outer = "hello"; (function(outer) { setInterval(function() {alert(outer);}, 100); })(outer); outer = "goodbye";

Functions important points

Strict Mode lets you opt-in to a more constrained subset of JavaScript (function () { "use strict"; // this function is strict... x = 5; // Error! arguments.caller; // Error! arguments.callee; // Error! var o = { x: 5}; Object.freeze(o); o.x = 7; // Throws }());

demo Undeclared variables Writing to non-writable properties Eval introducing variables to outer scope Strict Mode

Questions?

Connect. Share. Discuss. Learning Microsoft Certification & Training Resources TechNet Resources for IT Professionals Resources for Developers

Evaluations Submit your evals online

Questions?