const digital_root = num => num > 9
? digital_root([...`${num}`].reduce((acc, n) => acc + +n, 0))
: num;
Note: It's recommended to use the Web Storage API (setItem, getItem, removeItem, key, length) to prevent the pitfalls associated with using plain objects as key-value stores.
const key = 'length';
localStorage[key] = 100;
console.log(localStorage[key]); // 0
console.log(localStorage.getItem(key)); // null
const key = 'length';
localStorage.setItem(key, 100);
console.log(localStorage[key]); // 1
console.log(localStorage.getItem(key)); // 100 (строкой)
p = (+length + +width) * 2;
var p, s_house, s_masonry, total;
// Ширина дома
var width = parseInt($('#width-metr').val());
// Высота дома
var height = parseInt($('#height-metr').val());
// Длинна дома
var length = parseInt($('#length-metr').val());
// Площадь двери и окна
var s_wind_doors = parseInt($('#more-metr').val());
// Вычислить площадь
p = (length + width) * 2;
console.log('Периметр дома:', p);