Add Babel as a dependency to your app's package.json file and define a start script:
{
"dependencies": {
"babel": "4.7.16"
},
"scripts": {
"start": "./node_modules/.bin/babel-node ./app.js"
}
}
/** | |
* <div class="text">Some text with <b>html</b>... Any length.</div> | |
* | |
*/ | |
$('.text').each(function(){ | |
var length = 5; | |
var details = $(this); | |
var original_html = details.html(); | |
var original_text = details.text(); | |
var truncated_text = $.trim(original_text).substring(0, length).split(" ").slice(0, -1).join(" ") + " "; |
var timer; | |
$('input').on('change keyup', function(){ | |
clearTimeout(timer); | |
timer = setTimeout(function(){ | |
console.log('submit'); | |
},3000) | |
}) |
/* Set up Git Configuration */ | |
git config --global user.email "[email protected]" | |
git config --global user.name "Your Name" | |
git config --global core.editor "vi" | |
git config --global color.ui true |
Add Babel as a dependency to your app's package.json file and define a start script:
{
"dependencies": {
"babel": "4.7.16"
},
"scripts": {
"start": "./node_modules/.bin/babel-node ./app.js"
}
}
{ | |
"preset": "airbnb", | |
"requireCurlyBraces": null | |
} |
function ObjFactory(initialPrivateVariableForAll) { | |
var privateVariableForAll = initialPrivateVariableForAll; | |
return function ObjConstructor(initialPrivateVariableForInstance) { | |
var privateVariableForInstance = initialPrivateVariableForInstance; | |
return { | |
getInitialPrivateVariableForAll: function() { | |
return initialPrivateVariableForAll; | |
}, | |
getInitialPrivateVariableForInstance: function() { |
class ObjFactory { | |
constructor(author) { | |
this.author = author; | |
} | |
createCar(model) { | |
return new Car(this.author, model); | |
} | |
createHuman(name) { |
/* | |
import User from './User'; | |
let u1 = new User('anton'); | |
let u2 = new User('vadim'); | |
console.log(u1); | |
console.log(u2); | |
console.log(u1.getTitle()); | |
console.log(u2.getTitle()); |
class Item { | |
constructor(params) { | |
this.id = getItemId(); | |
this.params = params; | |
addItem(this); | |
} | |
destroy() { | |
destroyItem(this.id); | |
} |
class Item { | |
constructor() { | |
this.id = Item.count++; | |
} | |
} | |
Item.count = 0; | |
Item.getCount = function() { | |
return this.count; | |
}; |