background preloader

Javascript

Facebook Twitter

Mageia - Understanding “Prototypes” in JavaScript « Katz Got Your Tongue? - Iceweasel. For the purposes of this post, I will be talking about JavaScript objects using syntax defined in ECMAScript 5.1.

mageia - Understanding “Prototypes” in JavaScript « Katz Got Your Tongue? - Iceweasel

The basic semantics existed in Edition 3, but they were not well exposed. In JavaScript, objects are pairs of keys and values (in Ruby, this structure is called a Hash; in Python, it's called a dictionary). For example, if I wanted to describe my name, I could have an object with two keys: firstName would point to "Yehuda" and lastName would point to "Katz".

Keys in a JavaScript object are Strings. To create the simplest new object in JavaScript, you can use Object.create: var person = Object.create(null); Why didn't we just use var person = {};? Person['name'] If the String is a valid identifier[1], you can use the dot form: person.name [1] in general, an identifier starts with a unicode letter, $, _, followed by any of the starting characters or numbers. So now you have an empty object. Obviously, a property has a name and a value. Obviously, this is extremely verbose. Mageia - What's a Closure? - Iceweasel. JavaScript xPerience. Create a Game Character with HTML5 and JavaScript { William Malone } By William Malone In Part 1 of this series we will design a game character from scratch.

Create a Game Character with HTML5 and JavaScript { William Malone }

We will start with a drawing on paper and with the help of JavaScript we will create a breathing, blinking character on HTML5 canvas. Hopefully by the end of Part 1 you will have the tools and inspiration to create a character of your own. Idea to Pixels First we start with an idea. The next step is to get our idea to pixels. Next we color in the outlines. We are creating a dynamic character so we create our character in distinct parts. Head Hair Torso Legs Left Arm Right Arm Each part is saved as a seperate png image.

Draw on HTML5 Canvas With the design of our character complete and in the form of six images, we start the process putting our character on canvas. First we create a new object to hold our image references called images. We want to know when all of the images are loaded so we can begin drawing. During the redraw process the canvas will be cleared and all parts will be redrawn. Eyes Shadow.

CoffeeScript

JavaScript is Dead. Long Live JavaScript! For 16 years, JavaScript has been the language of the web browser.

JavaScript is Dead. Long Live JavaScript!

This language has enabled the building of compelling web applications and contributed to the success of the web. Other scripting languages could have filled the role JavaScript does but JavaScript was in the right place at the right time. Microsoft added Basic to Internet Explorer a long time ago but JavaScript was the language in all the browsers and so it won. Since JavaScript has been cross-browser and at least good enough, the browser makers have not needed to add other language interpreters to the browsers themselves. But we still didn’t choose to use JavaScript. Still, JavaScript has been a great language.

In very recent times, JavaScript has been making its most successful attempt at being a server-side language. Overall, JavaScript has been a wild success. One of the most obvious deficiencies in JavaScript is with its user interface: its syntax. The Case for Syntax Extensions: Verbose Idioms Let Modules Inheritance. Info - How do JavaScript closures work. CommonJS: JavaScript Standard Library. Node.js.