.image-products>div {
border: 1px solid red;
margin-top: 10px;
}
<div class="image-products">
<img src="http://www.cscl.ru/images/articles/logo-cs-1-6.jpg">
<img src="http://www.cscl.ru/images/articles/logo-cs-1-6.jpg">
</div>
let div_first_image = document.createElement('div');
let div_last_image = document.createElement('div');
div_first_image.className = 'product-thumb-primary';
div_last_image.className = 'product-thumb-secondary';
let first_img = document.querySelectorAll('.image-products img:first-child')[0];
let second_img = document.querySelectorAll('.image-products img:last-child')[0];
let parentDiv = document.querySelector(".image-products");//лучше через ID
parentDiv.removeChild(first_img);
parentDiv.removeChild(second_img);
div_first_image.appendChild(first_img);
div_last_image.appendChild(second_img);
parentDiv.appendChild(div_first_image)
parentDiv.appendChild(div_last_image)
let persons = [];
/*var person = {
name: '',
sname: '',
age: ''
};*/
function ask() {
let person = {};
person.name = prompt("Введите свое имя:");
person.sname = prompt("Введите свою фамилию:");
person.age = prompt("Введите свой возраст:");
persons.push(person);
ask1();
}
function ask1() {
let a = prompt("Ввести еще одного пользователя?", "");
if (a != null) {
ask();
}
else {
test();
//либо persons.forEach(say);
};
}
let res;
function test() {
res = persons.map((persona, n) => `persona №${n}- name: ${persona.name}; sname: ${persona.sname}; age: ${persona.age}`).join("<br />");
document.write("<p>" + res+"</p>");
}
function say(person, personNum) {
document.write("Номер: " + personNum + "<br/>");
document.write("Имя: " + person.name + "<br/>");
document.write("Фамилия: " + person.sname + "<br/>");
document.write("Возраст: " + person.age + "<br/>");
document.write("\n");
}
ask();
//say();
console.log(minSum);
console.log(parseFloat(minSum))
console.log(<?=$_SESSION['totalbasket']?>);
console.log(parseFloat(<?=$_SESSION['totalbasket']?>));
parseFloat(<?php echo $_SESSION['totalbasket'];?>
function resString(str, num) {
return str.split(" ").map(function (a) {
if (a.length >= num) {
var q = [];
a.split("").forEach(function (z, n) {
if ((n + 1) % num === 0) {
q.push(z, "\n");
} else {
q.push(z);
};
});
return q.join("");
};
return a;
}).join(" ");
};
console.log(resString("kekekekekekekekekekeke",5))