JavaScript fundamental data types and functions
Upcoming SlideShare
Loading in...5

Like this? Share it with your network


JavaScript fundamental data types and functions

Uploaded on

A look at the data types and how functions are invoked in JavaScript

A look at the data types and how functions are invoked in JavaScript

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 2 2

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide
  • Value defaults to undefinedWritable defaults to falseConfigurable defaults to falseEnumerable defaults to falseGet defaults to undefinedSet defaults to undefined
  • Method: local objectFunction: global object // mistake, should be outer function this objectthat work-aroundConstructor: new objectApply: choose, list of parameters


  • 1. JavaScript 101 André Odendaal
  • 2. Background Netscape Navigator Designed by Brendon Eich in 1995 Built to replace Java for the web and be “easy to use” Principles from Java (syntax), Self (prototypes) & Scheme (functional) Rushed to market with good, bad & questionable design choices Microsoft created Jscript, a compatible dialect to avoid trademark issues ECMA Standardized by ECMA (European Computer Manufacturers Association) Called ECMAScript between Netscape & Microsoft Latest version 5 includes “strict mode” for more thorough error checking
  • 3. Basic Types number Only 64-bit floating point No integers, longs, doubles, signed or unsigned to complicate matters Associative Law does not hold for some values (a + b) + c === a + (b + c) string 0 or more 16-bit Unicode (UCS-2) characters. No character type boolean true & false
  • 4. Objects Object Literals Dynamic (not based on pre-defined class) collection of properties Property names must be a unique string within the object Basic Operations – Get, Set & Delete | object[name] = value | object[name] = value delete | delete object[name] Property Named collection of attributes ES5 added functionality to define properties and added Get, Set functions Attributes: value, writable, configurable, enumerable, get, set
  • 5. Demo – Objects
  • 6. Object Types Arrays Special object with index as property names (not associative) Has properties like: length, sort(), filter() RegEx Regular expression object 2 primary methods exec() returns a match and test() returns boolean Functions An object which can be invoked with parentheses ()
  • 7. Demo – Objects Revisited
  • 8. Other Types null Nothing undefined Less than nothing
  • 9. Functions Composition Made up of 4 parts: function, name (optional), parameters, set of statements 2 additional parameters: arguments object & this (invocation context) Invocation Method – this is the local object Function – this is the global object Apply – this is passed as a parameter Constructor – this is the new object Calling Assigning less parameters will make them undefined
  • 10. Demo – Invoking Functions
  • 11. Inheritance with Prototypes Prototype with functions All functions have a property prototype as a base object Use new keyword with function invocation to create new objects Constructor functions should start with a capital letter Inheritance If object doesn’t have a property look in base object
  • 12. Demo - Prototyping
  • 13. Questions?