return (
<input type="button" onClick={ this.handleClick.bind(this, objectTest) } />
);
window.addEventListener('DOMContentLoaded', () => {
//...
});
var lineObjects = [];
function createPAtch(max) {
// ...
var randPosX=Math.floor(Math.random()*window.innerWidth);
var randPosY=Math.floor(Math.random()*window.innerHeight);
lineObjects.push({ x: randPosX, y: randPosY });
// ...
}
<div class="block"></div>
'use strict';
const block = document.querySelector('.block');
const replaced = block.outerHTML.replace(/div/g, 'span');
block.outerHTML = replaced;
'use strict';
let cache = {};
let url = '/index.php?page=1';
const page = document.querySelector('.page');
if (!cache[url]) {
fetch(url)
.then((response) => {
return response.text();
})
.then((data) => {
cache[url] = data;
page.innerHTML = data;
});
} else {
page.innerHTML = cache[url];
}
'use strict';
const invalidJSON = `{"root": {'html': '<div class="header1"></div>', 'fragment': '<div class="footer"></div>'}}`;
let validJSON = invalidJSON.replace(/'/g, '"');
validJSON = validJSON.replace(/="+[A-z0-9]*"/g, (str) => {
return str.replace(/"/g, '\\"');
});
console.log(validJSON);
// => {"root": {"html": "<div class=\"header1\"></div>", "fragment": "<div class=\"footer\"></div>"}}
var total_price = null;
$(document).on('change', 'input.itemsInv', function(){
//...
total_price = parseFloat($(".Q131bgfh4vn").text());
//...
});
$("#sendTradeOfferForPay").on('click', function(){
//...
data: {items: items, total: total_price, steamid: $("#itemsContainer").data('steamid'), token: $("#itemsContainer").data('token') },
//...
});