Skip to content

Instantly share code, notes, and snippets.

@egrueter-dev
egrueter-dev / functional-programming1.js
Last active March 4, 2017 02:54
functional-programming1
function mapForEach(arr, fn) {
const newArr = [];
for (let i=0; i < arr.length; i++) {
newArr.push(
fn(arr[i])
);
};
return newArr;
}
@egrueter-dev
egrueter-dev / basic-ruby-inheritance.rb
Created March 4, 2017 04:00
basic-ruby-inheritance
class Mammal
def breathe
puts "inhale and exhale"
end
end
class Cat < Mammal
def speak
puts "Meow"
end
@egrueter-dev
egrueter-dev / function-expression.js
Created March 4, 2017 15:34
function-expressions
var myFunction = function [name]([param1[, param2[, ..., paramN]]]) {
statements
};
@egrueter-dev
egrueter-dev / function-property.js
Created March 4, 2017 16:41
function-property
function fun() {
console.log("hello world");
}
fun();
fun.greeting = "Hello from property";
console.log(fun.greeting) //=> "Hello from property"