console.log(/name=([\"\'])([^\"\']+)\1/.exec('<span name="two">text</span>')[2]);
function _getAttr (str, attr) {
return new RegExp(attr + "\s*=\s*([\"\'])([^\"\']+)\\1").exec(str)[2];
}
console.log(_getAttr('<span name="two">text</span>', 'name'));
function Equipment() {
const Bag = [];
function addTools() {
for (var i=0; i < tools; i++) {
Bag.push(tools.item1)
}
Object.assign(Bag, new tools);
console.log('=== ', Bag.item2)
}
addTools()
}
function tools() {
this.item1 = {
name: "item1",
price: 5,
count: 10
};
this.item2 = {
name: "item2",
price: 15,
count: 20
};
this.item3 = {
name: "item3",
price: 20,
count: 30
};
this.item4 = {
name: "item4",
price: 30,
count: 40
};
this.item5 = {
name: "item5",
price: 40,
count: 50
};
}
Equipment();
cookies({
filterShow: 0
}, {
expires: 3600, // время жизни в секундах
path: '/'
});
if (obj instanceof Array) console.log('obj isArray!');