JSON edition

JSON vs JavaScript - differences:

In JS values can be of all the types JSON format can carry, plus 3 more: a function, a date, and undefined.

How to list keys of a JSON object? A recursive solution has been proposed by Patrick Fisher. Now, however, I shall try a simpler approach, trying to call the key of the row with the aid of row[0]. Worked with a tip from T. with : (key, row) in listOfProperties" and then using key and row afterwards.

Displaying inline data from JavaScript inside HTML

There is a construct in AngularJS called a filter and it looks as follows: <pre>{{cars | json}}</pre>.

RESTful APIs

There are thousands of APIs you can tap into and interconnect:
REST API concepts and examples

AngularJS - details

You use the double braces when you want to get the value: {{ name }} and you avoid them when you just do not need to see the value.

Learning more with Learn and Understand AngularJS - The First 50 Minutes by Tony Alicea

Dependency injection is a simple concept, but it enforces strong, stable architecture for your web applications.

jQuery dollar sign function explained:

$ is just a shortcut for jQuery. The idea is that everything is done with the one global symbol (since the global namespaces is ridiculously crowded), jQuery, but you can use $ (because it's shorter) if you like:

// These are the same barring your using noConflict (more below)
var divs = $("div");       // Find all divs
var divs = jQuery("div");  // Also find all divs, because
console.log($ === jQuery); // "true"

Vide the source

Functional data processing

I think the functional way may be the way to go for a long run. Now, however, it is time to get back to work. Saving my state.

Mr. Sinclair prepared an approachable introduction to functional JavaScript programming here, and some more materials on the topic here.

For Readable and clean code in JavaScript

Currying in JavaScript is realized simply by using Function.prototype.bind in the following manner:

function concat(a,b,c){ return [a,b,c].join('&'); }

concat('one','two','three');
// → "one&two&three"

var prefilled = concat.bind(null, 'four', 'five');
// → returns function wrapper

prefilled('six')
// → "four&five&six"

prefilled('seven')
// → "four&five&seven"

source

Duck typing

Duck typing – rozpoznawanie typu obiektu nie na podstawie deklaracji, ale przez badanie metod udostępnionych przez obiekt. Technika ta wywodzi się z powiedzenia: "jeśli chodzi jak kaczka i kwacze jak kaczka, to musi być kaczką".

Kacze typowanie znajduje najczęściej zastosowanie podczas rzutowania typów i przeciążania operatorów, w którym do określenia, czy obiekt może stworzyć wyrażenie z obiektem innego typu wykorzystywana jest odpowiednia metoda konwersji lub obsługi.

HTML Composition rules

How to compose HTML code for clear representation of sites? We do not need horizontal cascades of code as below: