class Test{
constructor(){
this.anybodyProperty = 0;
}
anybodyName() {
return new Promise(resolve => {
setTimeout(() => {
this.anybodyProperty = 1;
resolve(this.anybodyProperty);
}, 1000);
});
}
}
!async function (){
console.log(await (new Test().anybodyName()));
}()
#include <iostream>
#include <string>
int main()
{
int v = 100500;
for(auto &&c : std::to_string(v)){
std::cout << c << std::endl;
}
}
[1, 2, 10].sort(function(a,b){return a-b;})
#include <iostream>
#include <map>
#include <string>
int main() {
std::map<int,std::string> m = {
{1,"1"},
{2,"2"},
{3,"3"},
{4,"4"},
{5,"5"},
{6,"6"},
{7,"7"},
{8,"8"},
};
int i = 0;
for(auto it = --m.end();it != m.begin();--it,++i){
if(i>4){break;}
std::cout << it->first << ':' << it->second <<std::endl;
}
return 0;
}