SlideShare uma empresa Scribd logo
1 de 21
GameCraft Training




                     @Rado_g
 Client-side programming
 Console play >_
 JavaScript 101
 The DOM Tree
 JSON {coolness : “maximum”}
 jQuery (Where things get better)
 Object Oriented Programming – Classes, Interfaces,
  Methods, Scopes
 HTML & CSS (concept level)
 Executed by the Browser (Client side)
   Not(d)e – There’s also Server Side JS
 Serves for
   Doing fancy stuff with the HTML
   Creating richer UI
   AJAX
   Doing Web Applications

 Prototype based, dynamic, scripting language
Netbeans v. >= 6.9
Aptana Studio
JavaScript Development Tools for Eclipse
MyEclipse
Visual Studio (+ Telerik JustCode 4 JavaScript)
VIM
TextMate (ако ядете ябълки)
 Variables – no types. Defined with var
   var a = 5;
   var b = “string”;
   var getRandom = function(arg) { return arg+2; }
 Types are associated with values, not with variables
   typeof
 Arrays – can store different types in one array
   var arr = [1,2,3,4,5];
 Hashes (Maps) – but no Objects as keys
   var keyvalue = {name : “Rado”, age : 21, work :
    “GameCraft”}
 Lets have <script
  type=“text/javascript”>alert(“Hello”)</script> in an
  html page.
 Run the page via a web browser




 Let’s view the code  - include.html
 Also, you can use the src attribute :
  <script type=“text/javascript”
  src=“javascript/include.js”></script>
 JavaScript files end with .js
 You can include as many JavaScript files as you want
 Inclusion order is the order that the <script> tags were
  included

 Let’s view the code  - include2.html + include2.js
 We know how to
   Include JavaScript files in HTML
   Run them in the browser
   View the output in the console
   Define simple variables
 Next  typeof
 JavaScript is Dynamic Language, but there are types too
 Lets have the following code :
  var calc = function(a,b) { return a+b; }
   cacl(5,3)  8;
   calc(“rado”, “rado”)  “radorado”
   calc(true, true)  2
   calc(“rado”, true)  “radotrue”
 What if we want to sum only numbers ?
   Enter, typeof
   typeof(5)  “number”
   typeof(“rado”)  “string”
 Undefined is a special value for undefined variables
 var a; typeof(a); // “undefined”
 typeof(undefined); // “undefined”
 This is a standart check:
  if(typeof(something) !== “undefined”) { … }
 Arrays are defined without initial size
   var arr = []; // empty array
 There are few methods to deal with arrays
   arr.push(2); // now array has one element
   arr[0]; // 2
   arr[1]; // undefined
   arr.length; // 1
 But, if we want to check for arrays :
  typeof(arr) === “object”
 So there is a way :
   arr.constructor === Array (But we will talk later about
     Prototypes)
 Functions are something very important in
  JavaScript
 typeof(func) === “function”
 Functions can :
   Take functions as arguments
   Be anonymous
   Return functions
   Be assigned to variables
   Be Called from variables
 They also create objects and define scope
 Go go examples !
 Scope = visibility of variables
 Closure = function + all variables that are defined in the
    function’s scope
   We can “walk” between different closures
   Closures are created by functions
   A function can see its parent scope
   Window is the object at the top of the hierarchy
   Examples – closures.js
   More info - http://jibbering.com/faq/notes/closures/
 In JavaScript, there are no classes
 JavaScript works with Prototypes
 Objects are created by functions
 The function is the constructor
 Obj.hasOwnProperty() – testing for not
  prototype properties
 Examples – prototype.js, number.js,
  array_prototype.js, string_prototype.js
  namespace.js
{
 description : “XML on diet”,
 meaning : “JavaScript Simple Object Notation”,
 usedFor : [
 { case : “Create JS objects”} , { case : “Model for
 data-transportation”, {case : “Configuration files”}
             ]
 }
 Every big JS library is based on JSON
  configurations
 Examples 
 Always insert ;
 Never use the with() operator – random
  behaviour
 Never use new Array(). Use [] for creating arrays
 Always use === instead of == (== is broken)
 There is no block scope
   Declare all variables at the top of functions
 Avoid global variables as much as possible
 Use new only with InitialCaps variables

Mais conteúdo relacionado

Mais procurados

JavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJWORKS powered by Ordina
 
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...Doug Jones
 
JavaScript 101
JavaScript 101JavaScript 101
JavaScript 101ygv2000
 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and StatementsWebStackAcademy
 
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript TutorialBui Kiet
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptWalid Ashraf
 
Reactive Web Applications with Scala & Liftweb - CodeWeek 2015
Reactive Web Applications with Scala & Liftweb - CodeWeek 2015Reactive Web Applications with Scala & Liftweb - CodeWeek 2015
Reactive Web Applications with Scala & Liftweb - CodeWeek 2015Andrea Zaza
 
All You Need to Know About Type Script
All You Need to Know About Type ScriptAll You Need to Know About Type Script
All You Need to Know About Type ScriptFolio3 Software
 
JavaScript objects and functions
JavaScript objects and functionsJavaScript objects and functions
JavaScript objects and functionsVictor Verhaagen
 
JavaScript Fundamentals & JQuery
JavaScript Fundamentals & JQueryJavaScript Fundamentals & JQuery
JavaScript Fundamentals & JQueryJamshid Hashimi
 
Typescript tips & tricks
Typescript tips & tricksTypescript tips & tricks
Typescript tips & tricksOri Calvo
 
Programming Android Application in Scala.
Programming Android Application in Scala.Programming Android Application in Scala.
Programming Android Application in Scala.Brian Hsu
 

Mais procurados (20)

JavaScript Data Types
JavaScript Data TypesJavaScript Data Types
JavaScript Data Types
 
Introduction to JavaScript Programming
Introduction to JavaScript ProgrammingIntroduction to JavaScript Programming
Introduction to JavaScript Programming
 
Javascript
JavascriptJavascript
Javascript
 
JavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UX
 
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
 
JavaScript 101
JavaScript 101JavaScript 101
JavaScript 101
 
Javascript 101
Javascript 101Javascript 101
Javascript 101
 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
 
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript Tutorial
 
Java script -23jan2015
Java script -23jan2015Java script -23jan2015
Java script -23jan2015
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
Reactive Web Applications with Scala & Liftweb - CodeWeek 2015
Reactive Web Applications with Scala & Liftweb - CodeWeek 2015Reactive Web Applications with Scala & Liftweb - CodeWeek 2015
Reactive Web Applications with Scala & Liftweb - CodeWeek 2015
 
Object Oriented Javascript
Object Oriented JavascriptObject Oriented Javascript
Object Oriented Javascript
 
All You Need to Know About Type Script
All You Need to Know About Type ScriptAll You Need to Know About Type Script
All You Need to Know About Type Script
 
Anonymous functions in JavaScript
Anonymous functions in JavaScriptAnonymous functions in JavaScript
Anonymous functions in JavaScript
 
JavaScript objects and functions
JavaScript objects and functionsJavaScript objects and functions
JavaScript objects and functions
 
JavaScript Fundamentals & JQuery
JavaScript Fundamentals & JQueryJavaScript Fundamentals & JQuery
JavaScript Fundamentals & JQuery
 
Javascript
JavascriptJavascript
Javascript
 
Typescript tips & tricks
Typescript tips & tricksTypescript tips & tricks
Typescript tips & tricks
 
Programming Android Application in Scala.
Programming Android Application in Scala.Programming Android Application in Scala.
Programming Android Application in Scala.
 

Destaque

JavaScript 101 - Class 1
JavaScript 101 - Class 1JavaScript 101 - Class 1
JavaScript 101 - Class 1Robert Pearce
 
Game Craft - Company Description
Game Craft - Company DescriptionGame Craft - Company Description
Game Craft - Company DescriptionRadoslav Georgiev
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScriptBryan Basham
 
Modern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design PatternsModern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design PatternsVolodymyr Voytyshyn
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript ProgrammingSehwan Noh
 
How to create great slides for presentations
How to create great slides for presentationsHow to create great slides for presentations
How to create great slides for presentationsmikejeffs
 
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...SlideShare
 
10 Tips for WeChat
10 Tips for WeChat10 Tips for WeChat
10 Tips for WeChatChris Baker
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShareSlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShareSlideShare
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksSlideShare
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShareSlideShare
 
20 Ideas for your Website Homepage Content
20 Ideas for your Website Homepage Content20 Ideas for your Website Homepage Content
20 Ideas for your Website Homepage ContentBarry Feldman
 

Destaque (15)

JavaScript 101 - Class 1
JavaScript 101 - Class 1JavaScript 101 - Class 1
JavaScript 101 - Class 1
 
Game Craft - Company Description
Game Craft - Company DescriptionGame Craft - Company Description
Game Craft - Company Description
 
Introduction to JavaScript Basics.
Introduction to JavaScript Basics.Introduction to JavaScript Basics.
Introduction to JavaScript Basics.
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Modern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design PatternsModern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design Patterns
 
Github basics
Github basicsGithub basics
Github basics
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript Programming
 
How to create great slides for presentations
How to create great slides for presentationsHow to create great slides for presentations
How to create great slides for presentations
 
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
 
10 Tips for WeChat
10 Tips for WeChat10 Tips for WeChat
10 Tips for WeChat
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShare
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & Tricks
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShare
 
20 Ideas for your Website Homepage Content
20 Ideas for your Website Homepage Content20 Ideas for your Website Homepage Content
20 Ideas for your Website Homepage Content
 

Semelhante a JavaScript Basics - GameCraft Training

Semelhante a JavaScript Basics - GameCraft Training (20)

JavaScript Misunderstood
JavaScript MisunderstoodJavaScript Misunderstood
JavaScript Misunderstood
 
Ajax and JavaScript Bootcamp
Ajax and JavaScript BootcampAjax and JavaScript Bootcamp
Ajax and JavaScript Bootcamp
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues
 
Reversing JavaScript
Reversing JavaScriptReversing JavaScript
Reversing JavaScript
 
Art of Javascript
Art of JavascriptArt of Javascript
Art of Javascript
 
Object Oriented Programming In JavaScript
Object Oriented Programming In JavaScriptObject Oriented Programming In JavaScript
Object Oriented Programming In JavaScript
 
JavaScript Workshop
JavaScript WorkshopJavaScript Workshop
JavaScript Workshop
 
jQuery introduction
jQuery introductionjQuery introduction
jQuery introduction
 
Intro to Scala.js - Scala UG Cologne
Intro to Scala.js - Scala UG CologneIntro to Scala.js - Scala UG Cologne
Intro to Scala.js - Scala UG Cologne
 
Scala for Java Programmers
Scala for Java ProgrammersScala for Java Programmers
Scala for Java Programmers
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Jet presentation
Jet presentationJet presentation
Jet presentation
 
Scala uma poderosa linguagem para a jvm
Scala   uma poderosa linguagem para a jvmScala   uma poderosa linguagem para a jvm
Scala uma poderosa linguagem para a jvm
 
Java Intro
Java IntroJava Intro
Java Intro
 
Handout - Introduction to Programming
Handout - Introduction to ProgrammingHandout - Introduction to Programming
Handout - Introduction to Programming
 
AJS UNIT-1 2021-converted.pdf
AJS UNIT-1 2021-converted.pdfAJS UNIT-1 2021-converted.pdf
AJS UNIT-1 2021-converted.pdf
 
Javascript
JavascriptJavascript
Javascript
 
javascript
javascript javascript
javascript
 

Último

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 

Último (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 

JavaScript Basics - GameCraft Training

  • 2.  Client-side programming  Console play >_  JavaScript 101  The DOM Tree  JSON {coolness : “maximum”}  jQuery (Where things get better)
  • 3.  Object Oriented Programming – Classes, Interfaces, Methods, Scopes  HTML & CSS (concept level)
  • 4.  Executed by the Browser (Client side)  Not(d)e – There’s also Server Side JS  Serves for  Doing fancy stuff with the HTML  Creating richer UI  AJAX  Doing Web Applications  Prototype based, dynamic, scripting language
  • 5.
  • 6. Netbeans v. >= 6.9 Aptana Studio JavaScript Development Tools for Eclipse MyEclipse Visual Studio (+ Telerik JustCode 4 JavaScript) VIM TextMate (ако ядете ябълки)
  • 7.  Variables – no types. Defined with var  var a = 5;  var b = “string”;  var getRandom = function(arg) { return arg+2; }  Types are associated with values, not with variables  typeof  Arrays – can store different types in one array  var arr = [1,2,3,4,5];  Hashes (Maps) – but no Objects as keys  var keyvalue = {name : “Rado”, age : 21, work : “GameCraft”}
  • 8.  Lets have <script type=“text/javascript”>alert(“Hello”)</script> in an html page.  Run the page via a web browser  Let’s view the code  - include.html
  • 9.  Also, you can use the src attribute : <script type=“text/javascript” src=“javascript/include.js”></script>  JavaScript files end with .js  You can include as many JavaScript files as you want  Inclusion order is the order that the <script> tags were included  Let’s view the code  - include2.html + include2.js
  • 10.  We know how to  Include JavaScript files in HTML  Run them in the browser  View the output in the console  Define simple variables  Next  typeof
  • 11.
  • 12.  JavaScript is Dynamic Language, but there are types too  Lets have the following code : var calc = function(a,b) { return a+b; }  cacl(5,3)  8;  calc(“rado”, “rado”)  “radorado”  calc(true, true)  2  calc(“rado”, true)  “radotrue”  What if we want to sum only numbers ?  Enter, typeof  typeof(5)  “number”  typeof(“rado”)  “string”
  • 13.  Undefined is a special value for undefined variables  var a; typeof(a); // “undefined”  typeof(undefined); // “undefined”  This is a standart check: if(typeof(something) !== “undefined”) { … }
  • 14.  Arrays are defined without initial size  var arr = []; // empty array  There are few methods to deal with arrays  arr.push(2); // now array has one element  arr[0]; // 2  arr[1]; // undefined  arr.length; // 1  But, if we want to check for arrays : typeof(arr) === “object”  So there is a way :  arr.constructor === Array (But we will talk later about Prototypes)
  • 15.  Functions are something very important in JavaScript  typeof(func) === “function”  Functions can :  Take functions as arguments  Be anonymous  Return functions  Be assigned to variables  Be Called from variables  They also create objects and define scope  Go go examples !
  • 16.
  • 17.  Scope = visibility of variables  Closure = function + all variables that are defined in the function’s scope  We can “walk” between different closures  Closures are created by functions  A function can see its parent scope  Window is the object at the top of the hierarchy  Examples – closures.js  More info - http://jibbering.com/faq/notes/closures/
  • 18.
  • 19.  In JavaScript, there are no classes  JavaScript works with Prototypes  Objects are created by functions  The function is the constructor  Obj.hasOwnProperty() – testing for not prototype properties  Examples – prototype.js, number.js, array_prototype.js, string_prototype.js namespace.js
  • 20. { description : “XML on diet”, meaning : “JavaScript Simple Object Notation”, usedFor : [ { case : “Create JS objects”} , { case : “Model for data-transportation”, {case : “Configuration files”} ] }  Every big JS library is based on JSON configurations  Examples 
  • 21.  Always insert ;  Never use the with() operator – random behaviour  Never use new Array(). Use [] for creating arrays  Always use === instead of == (== is broken)  There is no block scope  Declare all variables at the top of functions  Avoid global variables as much as possible  Use new only with InitialCaps variables