JSFiddle - React, Tailwind, and code Playground
by Chad Drummond
JavaScript
function Question(category, title) {
this.title;
this.category;
}
var defaultQuestion = Question.bind({
title: 'Hello dude?',
category: 'Names'
});
// Set category to default of "Skills" (allows to be overridden)
// Binding to a context
var SkillsQuestion = Question.bind({ category: 'Skills' });
new SkillsQuestion(category, title);
// or Set category to be "Skills" always
// Binding to arguments
var SkillsQuestion = Question.bind(null, 'Skills');
new SkillsQuestion(title);
var manipulator = {
add: function(value, value) {
this.value = this.value + value;
}
};
var calculator = {
value: 0
};
var calcTotal = manipulator.add.bind(calculator, 50);
calcTotal();
manipulator.add.call(calculator, numOne, numTwo);
calculator.value === 50;
numbers = [numOne, numTwo];
manipulator.add.apply(calculator, numbers);
calculator.value ==
$('.links').click(function(event, element){
});
callback.bind(currentElement, event);
callback(event, element);