User:Krankuba

====the simplest, library-free code for implementing array intersections: ==== ​var arr = [1, 2, 3, 4, 5, 6, 7, 9]; var arr2 = [0, 3, 6, 7, 8, 9, 10]; arr.filter(function(n) {    return arr2.indexOf(n) != -1; }); //returns [3, 6, 9]

reverse a string:
var str = "something"; var strReversed = str.split().reverse.join(); //returns strReversed  = gnihtemos

sum all array elements:
var arr = [1, 2, 3, 4]; var arrTotal = arr.reduce(function(previousNum, currentNum) {      return previousNum + currentNum;     }); //returns arrTotal = 10

check for palindromes:
function palindrome(str) { var clearString = str.toLowerCase.replace(/[^0-9a-z]/gi, ).split(); for (var i = 0; i < clearString.length/2; i++) { if (clearString[i] !== clearString[clearString.length -1 -i]) { return false; }   }   return true; } function palindrome2(str) { str = str.replace(/\W/g, '').toLowerCase; return (str == str.split().reverse.join()); } palindrome("almostomla"); next item code code code next item code code code next item