import React from "react";
import moment from "moment";
import 'moment/locale/ru'; // create-react-app specific
moment.locale("ru");
const target = moment("2020-08-17 23:00:00");
const toNow = target.toNow(true);
export default function App() {
return (
<div>
<p>Осталось {toNow}</p>
</div>
);
}
return { ...acc, [name]: arg }
var tmp = {};
tmp[name] = arg;
return Object.assing({}, acc, tmp);
let num = 123456;
let sum = String(num)
.split('')
.reduce((acc, cur) => acc + Number(cur), 0)
alert(sum);
let num = 123456;
let sum = 0;
let str = String(num);
for (let i = 0; i < str.length; i++) {
sum += Number(str[i]);
}
alert(sum);