const main = createTableWithContent(val.join('-'), "one");
const two = createTableWithContent(randInt(), "two");
main.append(two);
// Просто добавить...
const three = createTableWithContent(randInt(), "three");
main.append(three);
<input class="price" oninput="calc()">
<input class="quantity" oninput="calc()">
<div id="result"></div>
function calc(){
const priceInput = document.querySelector('.price');
const quantityInput = document.querySelector('.quantity');
const cost = priceInput.value * quantityInput.value;
document.getElementById('result').innerHTML = cost;
}
class myPlugin {
constructor(element, options) {
this.element = element
this.options = Object.assign({}, {
option1: false,
option2: 600
}, options)
}
testMyEvent(){
if (typeof this.options.onEvent === 'function') {
this.options.onEvent(this.element, 123, this.options /* что угодно */);
}
}
}
const plugin = new myPlugin("#element", {
option1: false,
option2: 600,
onEvent: (element, num, opts) => {
console.log(element, num, opts)
}
});
plugin.testMyEvent();
function camelize(str) {
return str
.split('-')
.map(function(word, index) {
if (index == 0) {
return word;
} else {
return word[0].toUpperCase() + word.slice(1);
}
})
.join('')
}
let str = prompt('Введите текст через дефис');
alert(camelize(str));
function camelize(str) {
return str
.split('-')
.map((word, index) => index == 0 ? word : word[0].toUpperCase() + word.slice(1))
.join('')
}
let str = prompt('Введите текст через дефис');
alert(camelize(str));
const upper = (word, index) => index == 0 ? word : word[0].toUpperCase() + word.slice(1);
function camelize(str) {
return str
.split('-')
.map(upper)
.join('')
}
let str = prompt('Введите текст через дефис');
alert(camelize(str));
const upper = (word, index) => index == 0 ? word : word[0].toUpperCase() + word.slice(1);
const camelize = str => str.split('-').map(upper).join('');
let str = prompt('Введите текст через дефис');
alert(camelize(str));