SlideShare a Scribd company logo
Javascript Top level introduction
Agenda What is JavaScript? Types Class like structures Namespacing /global objects Designing widgets JSON Event handling Libraries
What is javascript? Dynamic loosely typed scripting language C/Java like syntax Class free, prototypical (copies of other objects) The language is good Browser implementations not so good. Good for reflective/ Introspective techniques
Types Object Array function (first-class, only construct with scope) Number String Immutable (like java) Missing methods (i.e. trim()) boolean null undefined ( nullpointer) Detect types using typeof
Class like structures Person = function (name,age) {  // constructor this.name = name;  //class variables this.age = age; }; Person.MALE = “male”;  //static variables Person.FEMALE=“female”; Person.prototype = { //methods toString : function (){ return this.name + " " + this.age; } }; var ash = new Person("Ash",23);  //instantiations
Global object alert(“hi”) window.alert(“hi”) window[“alert”](“hi”); window[“addSelectItemLink”+portletId](linkId,itemId);
Do’s and don’ts of Constructors [BAD]  var cuboid = new Cuboid(11,22,11,45,11);  [GOOD] var cuboid = new  Cuboid({ width:11, height:22, depth:11, weight:45 });
Namespacing Don’t clutter the global object (window) Namespace !! VYRE = {}; VYRE.Search = {}; VYRE.Basket = {}; VYRE.Linker = function (){ };
Bad practices var ob = {   prop1:”hi”, prop2:”hi again ” , }; for ( i = 0; i< collection.length; i++); for ( var  i = 0; i< collection.length; i++); setTimeout(“performFunction()”,500); setTimeout(performFunction,500); document.write eval
Widgets/Complex UI Design Good UI relies on a good domain model Don’t jump straight into visuals Think carefully about event handling Seperate concerns by creating small stateful objects Maximise collection usage Arrays if index and looping is needed Maps (Associative Arrays) for lookups
JSON (Javascript notation) In xml <person>  <firstName>Subbu</firstName>  <lastName>Allamaraju</lastName>  </person>  JSON ({  &quot;firstName&quot; : &quot;Subbu&quot;,  &quot;lastName&quot; : &quot;Allamaraju&quot;  });
JSON cont.. Is native javascript Is defacto standard for data interchange Is faster and less verbose than xml But more descriptive. JSONstring is a utility for marshalling/unmarshalling Used in ajax framework for cookie management.
3 rd  Party Libraries Component based  YUI ExtJs Page enhancement JQuery OOP / with visuals Prototype & scripacolous mootools
Debugging Firebug(firefox) console.log() profile Breakpoints Visual studio ( ie6/7/8)

More Related Content

PDF
Javascript status 2016
PPTX
A Blink Into The Rails Magic
PDF
⚛️ Reasonable React (with beers)
PPTX
All You Need to Know About Type Script
ODP
JavaScript Object Oriented Programming Cheat Sheet
PDF
WDB005.1 - JavaScript for Java Developers (Lecture 1)
PPTX
JavaScript Basics - GameCraft Training
Javascript status 2016
A Blink Into The Rails Magic
⚛️ Reasonable React (with beers)
All You Need to Know About Type Script
JavaScript Object Oriented Programming Cheat Sheet
WDB005.1 - JavaScript for Java Developers (Lecture 1)
JavaScript Basics - GameCraft Training

What's hot (9)

PPT
PPTX
Type script
PPTX
Things that every JavaScript developer should know by Rachel Appel at FrontCo...
PDF
JavaScript For CSharp Developer
PPTX
Java scriptforjavadev part1
PPTX
Advanced JavaScript
PDF
Javascript good parts - for novice programmers
PPTX
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
PDF
15 Minutes Null
Type script
Things that every JavaScript developer should know by Rachel Appel at FrontCo...
JavaScript For CSharp Developer
Java scriptforjavadev part1
Advanced JavaScript
Javascript good parts - for novice programmers
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
15 Minutes Null
Ad

Viewers also liked (18)

PDF
Privon'2014 - How To Publish Privately
PDF
Docker Casual Talk #2 - Dockerizing newrelic-sysmond
PPTX
Green Careers... What are they?
PDF
Translation memory
PPTX
Introductie e-neo
PPTX
Job Search in Tough Economy
PDF
Design pattern chapter_3_template_pattern
PDF
Movie explorer - Moplo! Introduction
PDF
Ruby Enumerator(루비 열거자) 이해하기
PDF
Ruby codemetric automation server - Putne Introduction
PDF
Visualization and data mapping
KEY
Portlets
PDF
Ruby for biginner - Don't be suprised
PDF
Docker introduction
PDF
2015 07 31_yashin_project
PDF
이미지 기반의 배포 패러다임 Immutable infrastructure
PDF
Devfair kubernetes 101
PDF
도커(Docker) 메트릭스 & 로그 수집
Privon'2014 - How To Publish Privately
Docker Casual Talk #2 - Dockerizing newrelic-sysmond
Green Careers... What are they?
Translation memory
Introductie e-neo
Job Search in Tough Economy
Design pattern chapter_3_template_pattern
Movie explorer - Moplo! Introduction
Ruby Enumerator(루비 열거자) 이해하기
Ruby codemetric automation server - Putne Introduction
Visualization and data mapping
Portlets
Ruby for biginner - Don't be suprised
Docker introduction
2015 07 31_yashin_project
이미지 기반의 배포 패러다임 Immutable infrastructure
Devfair kubernetes 101
도커(Docker) 메트릭스 & 로그 수집
Ad

Similar to Javascript Ks (20)

PPT
JavaScript Misunderstood
PPT
Ajax and JavaScript Bootcamp
PPT
Java Intro
PPTX
Maintainable JavaScript 2012
PPTX
JavsScript OOP
PPTX
jQuery Data Manipulate API - A source code dissecting journey
PPTX
IWT presentation121232112122222225556+556.pptx
PPT
Javascript Templating
PPT
Oop java
KEY
JavaScript Growing Up
KEY
JavaScript Neednt Hurt - JavaBin talk
PPT
eXo SEA - JavaScript Introduction Training
PPTX
Object Oriented Programming In JavaScript
PPT
2007 09 10 Fzi Training Groovy Grails V Ws
PPT
Douglas Crockford Presentation Goodparts
PPT
A Deeper look into Javascript Basics
PPT
Goodparts
PDF
Javascript Design Patterns
PPTX
Object oriented javascript
PDF
Maintainable JavaScript 2011
JavaScript Misunderstood
Ajax and JavaScript Bootcamp
Java Intro
Maintainable JavaScript 2012
JavsScript OOP
jQuery Data Manipulate API - A source code dissecting journey
IWT presentation121232112122222225556+556.pptx
Javascript Templating
Oop java
JavaScript Growing Up
JavaScript Neednt Hurt - JavaBin talk
eXo SEA - JavaScript Introduction Training
Object Oriented Programming In JavaScript
2007 09 10 Fzi Training Groovy Grails V Ws
Douglas Crockford Presentation Goodparts
A Deeper look into Javascript Basics
Goodparts
Javascript Design Patterns
Object oriented javascript
Maintainable JavaScript 2011

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Big Data Technologies - Introduction.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
KodekX | Application Modernization Development
PDF
Machine learning based COVID-19 study performance prediction
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Approach and Philosophy of On baking technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Big Data Technologies - Introduction.pptx
Electronic commerce courselecture one. Pdf
KodekX | Application Modernization Development
Machine learning based COVID-19 study performance prediction
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
sap open course for s4hana steps from ECC to s4
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Empathic Computing: Creating Shared Understanding
Unlocking AI with Model Context Protocol (MCP)
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
MYSQL Presentation for SQL database connectivity
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Approach and Philosophy of On baking technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Mobile App Security Testing_ A Comprehensive Guide.pdf
Understanding_Digital_Forensics_Presentation.pptx

Javascript Ks

  • 1. Javascript Top level introduction
  • 2. Agenda What is JavaScript? Types Class like structures Namespacing /global objects Designing widgets JSON Event handling Libraries
  • 3. What is javascript? Dynamic loosely typed scripting language C/Java like syntax Class free, prototypical (copies of other objects) The language is good Browser implementations not so good. Good for reflective/ Introspective techniques
  • 4. Types Object Array function (first-class, only construct with scope) Number String Immutable (like java) Missing methods (i.e. trim()) boolean null undefined ( nullpointer) Detect types using typeof
  • 5. Class like structures Person = function (name,age) { // constructor this.name = name; //class variables this.age = age; }; Person.MALE = “male”; //static variables Person.FEMALE=“female”; Person.prototype = { //methods toString : function (){ return this.name + &quot; &quot; + this.age; } }; var ash = new Person(&quot;Ash&quot;,23); //instantiations
  • 6. Global object alert(“hi”) window.alert(“hi”) window[“alert”](“hi”); window[“addSelectItemLink”+portletId](linkId,itemId);
  • 7. Do’s and don’ts of Constructors [BAD] var cuboid = new Cuboid(11,22,11,45,11); [GOOD] var cuboid = new Cuboid({ width:11, height:22, depth:11, weight:45 });
  • 8. Namespacing Don’t clutter the global object (window) Namespace !! VYRE = {}; VYRE.Search = {}; VYRE.Basket = {}; VYRE.Linker = function (){ };
  • 9. Bad practices var ob = { prop1:”hi”, prop2:”hi again ” , }; for ( i = 0; i< collection.length; i++); for ( var i = 0; i< collection.length; i++); setTimeout(“performFunction()”,500); setTimeout(performFunction,500); document.write eval
  • 10. Widgets/Complex UI Design Good UI relies on a good domain model Don’t jump straight into visuals Think carefully about event handling Seperate concerns by creating small stateful objects Maximise collection usage Arrays if index and looping is needed Maps (Associative Arrays) for lookups
  • 11. JSON (Javascript notation) In xml <person> <firstName>Subbu</firstName> <lastName>Allamaraju</lastName> </person> JSON ({ &quot;firstName&quot; : &quot;Subbu&quot;, &quot;lastName&quot; : &quot;Allamaraju&quot; });
  • 12. JSON cont.. Is native javascript Is defacto standard for data interchange Is faster and less verbose than xml But more descriptive. JSONstring is a utility for marshalling/unmarshalling Used in ajax framework for cookie management.
  • 13. 3 rd Party Libraries Component based YUI ExtJs Page enhancement JQuery OOP / with visuals Prototype & scripacolous mootools
  • 14. Debugging Firebug(firefox) console.log() profile Breakpoints Visual studio ( ie6/7/8)