Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

reverse int js

function reverseInt(n) {
  let reversed = n.toString().split("").reverse().join("");
  //from string to integer
  reversed = parseInt(reversed);

  if (n < 0) {
    return reversed * -1;
  }

  return reversed;
}
Source by www.codevscolor.com #
 
PREVIOUS NEXT
Tagged: #reverse #int #js
ADD COMMENT
Topic
Name
2+8 =