Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@marani
marani / once.js
Last active September 14, 2016 15:20
once
function once(fn) {
var executed = false;
var executer() {
if (!executed) {
fn.apply(arguments);
executed = true;
} else {
console.log('function already executed');
}
}
alert('6');