This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="style.css"/> | |
<script type="text/javascript" src="script.js"></script> | |
</head> | |
<body> | |
<button id="button">Click me!</button> | |
<div id="new-color"></div> | |
<div id="all-colors"></div> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map = { | |
"USA": { "Detroit": 23, "Cambridge": 5, "Cupertino": 0.5 }, | |
"Canada": { "Waterloo": 1 }, | |
"Switzerland": { "Geneva": 0.5 } | |
} | |
d = new Dict(map); | |
d.getDict("USA").get("Detroit"); // => 23 | |
d.getDict("China", {}).get("Beijing", 0); // => 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pet = Model.extend({}) | |
PetController = Controller.extend({ | |
"initialize": function (options) { | |
this.names = options.names; | |
this.model = this.spawn(Pet) | |
this.view = this.spawn(PetView, { | |
"model": this.model | |
}) // "names" is passed implicitly | |
this.view.render(); |