0

JS Question

Hello everyone who can help me with this question? Given a positive integer. Bring the last digit of the number to the beginning. Print the new number. If the last digit of the inserted number is 0, number remains the

2nd Aug 2019, 1:56 PM
Dav
Dav - avatar
6 odpowiedzi
0
I know fundamentals and I should solve it using function
2nd Aug 2019, 2:24 PM
Dav
Dav - avatar
0
Ok i will try to solve it on paper first🙂
2nd Aug 2019, 2:31 PM
Dav
Dav - avatar
0
1. Just for enrichment purpose, JavaScript allows the string and Array way, which is like this : https://code.sololearn.com/W4ILK13XXSY3/?ref=app 2. Since this question looks like a school homework, so it is not likely that you can use the string way. the Maths way is modulus 10, try to derive the maths way yourself. 3. a. Read this about the % operator to get the remainder when a number is divided by 10. https://www.sololearn.com/learn/JavaScript/1130/ 3. b. Then read this about if else statements to handle last digit 0 or not 0 https://www.sololearn.com/learn/JavaScript/1137/ 4. If you get stuck, show us your code attempt add link to your code in this way : https://www.sololearn.com/post/75089/?ref=app
2nd Aug 2019, 3:29 PM
Gordon
Gordon - avatar
0
Thank you
2nd Aug 2019, 3:36 PM
Dav
Dav - avatar