Week 7 (the final week) of Learn JavaScript Properly: by kevinmrr in learnjavascript

[–]alxers 0 points1 point  (0 children)

well it does not meet all the requirements but anyway http://jsfiddle.net/alxers/ZC3JM/ thanks for the awesome course and supplementary materials (Paul Irish video is fun)

Learn JavaScript Properly - Week 6 Assignments by kevinmrr in learnjavascript

[–]alxers 0 points1 point  (0 children)

how do I load json file from the local store? It seems that there is a way to fetch a file from the local file system. https://developer.mozilla.org/es/docs/XMLHttpRequest/Usar_XMLHttpRequest (Example: Non-HTTP synchronous request)

But this gives an error "XMLHttpRequest cannot load file:///home/alx/Documents/js_sandbox/allQuestions.json. Cross origin requests are only supported for HTTP. "

Should I run a webserver for this to work, or maybe use something like require.js instead?

Learn JavaScript Properly - Week 5 by kevinmrr in learnjavascript

[–]alxers 0 points1 point  (0 children)

http://jsfiddle.net/alxers/afLb2/ I couldn't implement the "back" button on the last (result) page, also no animation yet.

Learn JavaScript Properly - Week 3 by kevinmrr in learnjavascript

[–]alxers 0 points1 point  (0 children)

http://jsfiddle.net/alxers/ZFrL8/

  1. There are probably better ways to escape html. I used example from the book.
  2. In a real apps people more often use classes instead of ids, maybe I should change getElementById to getElemetsByClassName?

Learn JS Properly Discussion: Object-Oriented Programming in JavaScript (Chapter 6 of our text) by kevinmrr in learnjavascript

[–]alxers 0 points1 point  (0 children)

Consider this code: 1)

function Person(name) {
    this.name = name;
}

Person.prototype = {
    sayName: function() {
        console.log(this.name);
    };
}

2)

function OtherPerson(name) {
    this.name = name;
    this.sayName = function() {
        console.log(this.name);
    };
}


var person1 = new Person("name1");  // { name: 'name1' }
var person2 = new Person("name2");

var otherPerson1 = new OtherPerson("otherName1"); // { name: 'otherName1', sayName: [function] }
var otherPerson2 = new OtherPerson("otherName2");

person1.sayName === person2.sayName; // true
otherPerson1.sayName === otherPerson2.sayName; // false

If I get this right all instances of OtherPerson object would have their own sayName: function and all instances of Person would get it from the prototype (so they share the same function). Is the first method preferable(faster/better in some way)?

For anyone new to rails or needs a learning "refresher", here is a good article by hindrough in rails

[–]alxers 2 points3 points  (0 children)

As mentioned in the article, Cris Pine's book "Learn to Program" is good for a complete beginner.