I hereby claim:
- I am srirangan on github.
- I am sri19 (https://keybase.io/sri19) on keybase.
- I have a public key ASBA4jE2007AhvAb7If04gJsZ3sVz9HhSv6_y36GgBx1Bgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
evina.on("some-event", function (context) { | |
console.log("some event happened") | |
}); | |
evina.trigger("some-event", {hello: "world"}); | |
evina.off("some-event"); |
<script src="evina.min.js"></script> |
<div id="redBox1" class="redBox"></div> | |
<div id="redBox2" class="redBox"></div> | |
<div id="redBox3" class="redBox"></div> | |
<div id="greenBox1" class="greenBox"></div> | |
<div id="greenBox2" class="greenBox"></div> | |
<div id="greenBox3" class="greenBox"></div> | |
<script> | |
(function () { |
const CIRCLE = "circle"; | |
const SQUARE = "square"; | |
const RECTANGLE = "rectangle"; | |
var getAreaFunction = function (shape) { | |
return function () { | |
switch (shape) { | |
case CIRCLE: | |
return Math.PI * arguments[0] * arguments[0]; | |
break; |
const CIRCLE = "circle"; | |
const SQUARE = "square"; | |
const RECTANGLE = "rectangle"; | |
var getAreaFunction = function (shape) { | |
return function () { | |
switch (shape) { | |
case CIRCLE: | |
return Math.PI * arguments[0] * arguments[0]; | |
break; |
var forEach = function (list, action) { | |
for (var i = 0; i < list.length; i++) { | |
action(list[i]); | |
} | |
}; | |
var reduce = function (combine, base, list) { | |
forEach(list, function (item) { | |
base = combine(base, item); | |
}); |
var forEach = function (list, action) { | |
for (var i = 0; i < list.length; i++) { | |
action(list[i]); | |
} | |
}; | |
var map = function (mappingFunction, list) { | |
var result = []; | |
forEach(list, function (item) { | |
result.push(mappingFunction(item)); |
var forEach = function (list, action) { | |
for (var i = 0; i < list.length; i++) { | |
action(list[i]); | |
} | |
}; | |
var logItem = function (item) { | |
console.log(item); | |
}; |
(function (name) { | |
console.log(name + " functions can be auto-executed on definition") | |
})("Anonymous"); | |
console.log("JavaScript provides functional scoping instead of block scoping"); | |
(function () { | |
if (true) { | |
var x = true; | |
console.log("Is 'x' available inside the block? " + x); | |
} |