<p class = "title title_size_big">
</p>
let assoc = {
one: 'Яблоко',
few: 'Яблока',
many: 'Яблок',
}
let number = 31;
let form = new Intl.PluralRules('ru-RU').select(number);
console.log(number, assoc[form]); // 31 Яблоко
Why Lodash?
Lodash makes JavaScript easier by taking the hassle out of working with arrays, numbers, objects, strings, etc.
Lodash’s modular methods are great for:
- Iterating arrays, objects, & strings
- Manipulating & testing values
- Creating composite functions
function getData(){
return $.ajax({
type: "POST",
url: "getdata.php",
});
}
getData.done(function(data){
alert(data);
});
async function getData() {
return new Promise(function(resolve, reject) {
$.ajax({
type: "POST",
url: "getdata.php",
success: function (msg) {
resolve(msg);
},
error: function (response) { // Данные не отправлены
reject('Ошибка. Данные не отправлены.');
}
});
});
}
let data = await getData();