Dashukevich Vladimir
function Person(name, age, job){this.name = name;this.age = age;this.print = function(){return name + " " + age;};};var i = new Person("vlad", 26, "programmer")
function createPerson(name, age, job){var o = new Object();o.name = name;o.age = age;o.print = function(){return name + " " + age;};};var i = createPerson("vlad", 26, "programmer")
function Person(){};Person.prototype = {name: "Vlad",age: 26,print: function(){return name + " " + age;}};var i = new Person();
function Person(){return {name: "Vlad",age: 26,print: function(){return name + " " + age;}};};var i = Person();
function extend(o){function f(){}f.prototype = o;return new f();};var person = new Person();var anotherPerson = extend(person);
function extendClass(Child, Parent){var f = function () { };f.prototype = Parent.prototype;var f = new F();for (var prop in Child.prototype)f[prop] = Child.prototype[prop];Child.prototype = f;Child.prototype.super = Parent.prototype;};
var person = new Person();var anotherPerson = Object.create(person, {name: {value: "Vladimir"}});
var summary = data.map(convertArray).filter(filterArray).map(take("temperature")).reduce(averageForArray, {})
function Person(name, age, job){this.name = name;this.age = age;this.job = job;this.print = function(){return name + " " + age + " " + job;};};
var person = new Person("Vladimir", 26, "Empty");//... code ...person.type = "type1";
var person = new Person("Vladimir", 26, "Empty");//... code ...person.type = "type1";//... code ...person.hair = "black";
var add = function(a, b){return a + b;};
var add = function(a, b){return a + b;};var sum = add(3, 4);
var add = function(a, b){return a + b;};var sum = add(3, 4);var concat = add("Hello ", "World");
class View {constructor(options) {this.model = options.model;this.template = options.template;}render() {return _.template(this.template, this.model.toObject());}}
class LogView extends View {render() {var compiled = super.render();console.log(compiled);}}
var person = {name: "vova"};Object.seal(person);//Object.freeze(person);person.age = 20; // Error!
var proxy = new Proxy({ name: "vova" }, {get: function(target, property) {if (property in target) {return target[property];} else {throw new ReferenceError("Property does not exist.");}}});
| CoffeeScript | JavaScript |
|---|---|
| is | === |
| isnt | !== |
| not | ! |
| and | && |
| or | || |
| true, yes, on | true |
| false, no, off | false |
launch() if ignition is on
if (ignition === true) {launch();}
linearSearch = (searchName) -> alert(name)for name in names when name is searchName
class Point {num x;num y;}void main(List<String> arguments) {var point = new Point();}
abstract class Cache<T> {T getByKey(String key);setByKey(String key, T value);}
interface Person {firstname: string;lastname: string;}function greeter(p : Person) {return "Hello, " + p.firstname + " " + p.lastname;}
HTMLElement* body=document.get_body();HTMLElement* newElement=document.createElement("h1");newElement->set_textContent("Hello World");body->appendChild(newElement);
var a = 42;var b = "a string";var z = a + b;//z = "42a string"eval("z = z.substr(1, 2)");//z = "2a"[1, "str", true, {three: 3}].forEach(function(item){if (typeof item === typeof z) console.log(item);});
function MyAsmModule(stdlib, foreign, heap){"use asm";//your perfect codereturn {export: f1};}
function MyAsmModule(stdlib, foreign, heap){"use asm";//your perfect codereturn {export: f1};}
function MyAsmModule(stdlib, foreign, heap){"use asm";//your perfect codereturn {export: f1};}
function MyAsmModule(stdlib, foreign, heap){"use asm";//your perfect codereturn {export: f1};}