Skip to content

Instantly share code, notes, and snippets.

@McLarenCollege
Last active December 22, 2021 03:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save McLarenCollege/270b77a1c7e139dd2a1847bdb4e884ee to your computer and use it in GitHub Desktop.
Save McLarenCollege/270b77a1c7e139dd2a1847bdb4e884ee to your computer and use it in GitHub Desktop.
Exercise : Number Split

Write a funcation called numberSplit which takes one number as a parameter. The function should return a string containing the two halves of the given number. If the number is odd, make the rightmost number higher. CODE TEMPLATE


function numberSplit(number){
// write your code here
}
console.log(numberSplit(4));// should return "22"
console.log(numberSplit(10));// should return "55"
console.log(numberSplit(11));// should return "56"
console.log(numberSplit(-9));// should return "-5-4"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment