Long JS question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Long JS question

I've asked this a few times before, and a few people didn't understand it or answered it with an unfinished/incorrect answer. So I'm hoping this will help. I have this code: https://code.sololearn.com/W9QNxKefinfV/#js Please, read through it carefully. It would be best if you understood my code if you wish to help me. Here's my question. For all examples, the input number will be 135. But remember. The input number is unknown and you should write your code with that in mind. Do not write anything specifically for the number 135. A few notes: I already have 2 parts of this equation finished. Remember what I said the example number is? If you input that into the textbox, the output should look like this: https://i.gyazo.com/79a8433f616bde0864dac6372540f6a3.png However, it's incomplete. I need the output to look like this: https://i.gyazo.com/d5980ed2ac93f36f7a5b99ef87aa07e4.png I ADDED THOSE LINES TO THE OUTPUT I DO NOT KNOW HOW TO ACTUALLY DISPLAY THAT YET Remember. The number is unknown and 135 is just an example number. Here's my problem: A number is called Disarium if sum of its digits powered with their respective positions is equal to the number itself. With 135 as our example number, that would look like this: 1^1+3^2+5^3 (Each digit powered to it's position in the number) What I need is to add the rest of the equation to the output. So this part: 1=1(Not sure how 1^1 would be displayed, but I think it should probably be 1*1) 3*3=9 5*5*5=125 Let's recap: I have a code that decides weather a number is disarium or not. The code has an output that displays an incomplete equation. I need help displaying the missing part That is this: 1=1(Again, not sure how to output this, but i'm assuming 1^1 could just be 1=1) 3*3=9 5*5*5=125 I hope you all understood this problem and can help me solve it.

25th Oct 2018, 10:31 PM
Daniel Cooper
Daniel Cooper - avatar
3 Answers
+ 2
Sure
27th Oct 2018, 9:44 PM
ODLNT
ODLNT - avatar
0
This is exactly what I was looking for ODLNT Can you explain to me exactly how you did this with comments?
26th Oct 2018, 5:14 AM
Daniel Cooper
Daniel Cooper - avatar