I hereby claim:
- I am makenova on github.
- I am makenova (https://keybase.io/makenova) on keybase.
- I have a public key whose fingerprint is ABA1 B0AE B622 C620 22A6 3014 60B0 E968 3FF9 37AA
To claim this, I am signing this object:
function xorleft (array0, array1){ | |
return array0.filter(array0element=>{ | |
return !array1.some(array1element=>{ | |
return array1element === array0element; | |
}); | |
}); | |
} | |
console.log(xor([1,2,3], [1,3])) // => [2] | |
console.log(xor([1,3], [1,2,3])) // => [] |
pt = require('./thisy'); | |
pt.printthis(); |
function evilCorp (name, laugh){ | |
this.name = name; | |
this.laugh = laugh; | |
} | |
evilCorp.prototype.takeover = function(){ | |
return "My name is " + this.name + " and I am your new master! " + this.laugh; | |
} | |
var $ = new evilCorp('condescendingSeniorDev', 'muwahaha'); |
{"answers":["function(console) {\n\tvar names = [\"Ben\", \"Jafar\", \"Matt\", \"Priya\", \"Brian\"],\n\t\tcounter;\n\n\tfor(counter = 0; counter < names.length; counter++) {\n\t\tconsole.log(names[counter]);\n\t}\n}\n\t\t","function(console) {\n\tvar names = [\"Ben\", \"Jafar\", \"Matt\", \"Priya\", \"Brian\"];\n\n\tnames.forEach(function(name) {\n\t\tconsole.log(name);\n\t});\n}\n\t\t","function() {\n\tvar newReleases = [\n\t\t{\n\t\t\t\"id\": 70111470,\n\t\t\t\"title\": \"Die Hard\",\n\t\t\t\"boxart\": \"http://cdn-0.nflximg.com/images/2891/DieHard.jpg\",\n\t\t\t\"uri\": \"http://api.netflix.com/catalog/titles/movies/70111470\",\n\t\t\t\"rating\": [4.0],\n\t\t\t\"bookmark\": []\n\t\t},\n\t\t{\n\t\t\t\"id\": 654356453,\n\t\t\t\"title\": \"Bad Boys\",\n\t\t\t\"boxart\": \"http://cdn-0.nflximg.com/images/2891/BadBoys.jpg\",\n\t\t\t\"uri\": \"http://api.netflix.com/catalog/titles/movies/70111470\",\n\t\t\t\"rating\": [5.0],\n\t\t\t\"bookmark\": [{ id:432534, time:65876586 }]\n\t\t},\n\...he largest rating. Rem |
I hereby claim:
To claim this, I am signing this object:
npm install -g supervisor
supervisor bin/www
npm install -g browser-sync
Adding a method on the constructor will duplicate that method for every instance of the object that created, consuming memory but also granting the method access private variables on the object. Adding a method on the prototype will will not duplicate it for new instances, conserving memory while leaving it available to all instances.
// Constructor with greet method directly on it.
var Person = function (name, age) {
These are my solutis that I came up with while doing the JS Challenge at usvsth3m.
They were reached 'under pressure' as the title implies, hence there are no
optimizations and it looks rough.
The problem description is stated before the solution.
Code as fast as you can! You need to double the integer and return it. To test your code, click Go or hit Ctrl-Enter/⌘-Enter.
function doubleInteger(i) {
Is it possible to write a custom asynchronous function without the use of JS's timer functions such as setTimeout
and setInterval
?
I have two code examples below, one that succeeds(goodboy.js) and one that fails(goodboyfail.js). I originally thought, goodboy.js would fail because I assumed
get
with a callback function would make it asyncronouspraise
would be undefined when it was executed.However, the console.log
messages seem to indicate that the get
function executes syncronously.
I got the expected behviour in goodboyfail.js by adding a delay.
These are notes I made while watching this video by
David Aragon from jQuery conf 2014.
He was kind enough to share his slides here.
I have copied some of his examples form the slides to provide context for my notes,
some of them have been slightly modified. Any errors, are likely my own. Caveat Lector.
JS uses functional scope not block scope like C or Scala, e.g. the if(){}
'block' is
not its own scope