Knowledge about traversal of object arrays underscore

for(name in object){}; traverse the object{};

for(var i=0;i<name.length;i++){};traverse

the array; print as an array: JSON.stringify(sht); console .log()

judges whether the object contains sths.hasOwnProrert(sth);//If it contains elements, the return value is true, if it does not contain elements, the return value is false;
_.first([5,2,3,8,6]); =>5 //The first element of the output array
_.initial([5,2,3,8,6]);=>[5,2,3,8] //The output result is other elements except the last element.
_.last([5,2,3,8,6]); =>6 //The return value is the last element
_.without([5,2,3,8,6],5,2); =>[3,8,6] //The value after deleting the array;
_.intersection([5,2,3,8,6],[6,2,5],[6,2]); =>[6,2] //Take the intersection of arrays

_.result(Object,'a[0].b.c1') //Get the deep elements in the object
_.some(users,['active',false]) //Determine whether the object contains certain elements, exists: true, no: false
_.valae





Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326119282&siteId=291194637