lecture 1
24-06-2016
Michael Trouw
Israel Menis
Who is here ?
let's see how far we get !
function(){
console.log('one way of writing functions....');
}function ()
{
console.log('and another way of writing functions.')
}JSHint is a community-driven tool to detect errors and potential problems in JavaScript code and to enforce your team's coding conventions.
JSLint is a JavaScript program that looks for problems in JavaScript programs. It is a code quality tool.
JSCS is a code style linter and formatter for your style guide
One Style to Rule Them All
(sudo) npm install -g standard
brackets
sublime text
visual studio code
atom
...others ?
Have you ever heard or done something with it ?
Who uses Linux ?
there are other git GUI apps for linux
Have you ever heard or done something with it ?
https://desktop.github.com/ (no linux client so far)
should be on (your) github
should conform to standardJs styleguide:
if you knowingly deviate from standardJs,
you have to be able to explain your reasoning.
The scope of a name binding – an association of a name to an entity, such as a variable – is the part of a computer program where the binding is valid: where the name can be used to refer to the entity
var width = 12; // width variable
var height = 'test'; // height variable
function calculateArea(width, height) {
try {
var area = width * height; // Try to calculate area
if (!isNaN(area)) { // If it is a number
return area; // Return the area
} else { // Otherwise throw an error
throw new Error('calculateArea() received invalid number');
}
} catch(e) { // If there was an error
console.log(e.name + ' ' + e.message); // Show error in console
return 'We were unable to calculate the area.'; // Show users a message
}
}
// TRY TO SHOW THE AREA ON THE PAGE
document.getElementById('area').innerHTML = calculateArea(width, height);Closures are functions INSIDE functions.
Yes, this is possible!
read: https://developer.mozilla.org/en/docs/Web/JavaScript/Closures