I need One Calculation. In this code. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

I need One Calculation. In this code.

https://code.sololearn.com/Wr4zmaIi2tIb/?ref=app If i add a one word in input from like a اسلام Its show me, All Characters : 5 Total Abjad : 132 Total Words : 1 All Characters List : ا : 1 س : 60 ل : 30 ا : 1 م : 40 .... I need one more calculation, Total Abjad is : 132 Like a : 132 | 1+2+3 : 6 I need this. Calculation last word. If total abjad is : 567 I need this : 5+6+7 : 18 / 1+8 : 9 I need last word like a 9 etc.

14th Jun 2021, 7:05 PM
𝐀𝐲𝐞𝐬𝐡𝐚 𝐍𝐨𝐨𝐫
𝐀𝐲𝐞𝐬𝐡𝐚 𝐍𝐨𝐨𝐫 - avatar
7 Answers
+ 4
Thanks So Much..
15th Jun 2021, 4:08 AM
𝐀𝐲𝐞𝐬𝐡𝐚 𝐍𝐨𝐨𝐫
𝐀𝐲𝐞𝐬𝐡𝐚 𝐍𝐨𝐨𝐫 - avatar
+ 3
use this function to get the digit sum of a number: function digitSum(num) { num = [...''+num].reduce((s,v) => +v+s,0); return 9<num ? digitSum(num) : num; }
14th Jun 2021, 7:46 PM
visph
visph - avatar
+ 3
Ayesha Noor you are too lazy to copy paste my working solution, and even too lazy to test the Furqan_Elahie [Imaziue Coders] not working code: display 0 for sum of digits of 567 (while 9 expected ^^)
15th Jun 2021, 3:11 AM
visph
visph - avatar
+ 3
Oh: I've forgot that mine solution was tested with directly applying the number (convrerted): I cannot type such language numbers as I don't know them and I don't have a keyboard able to type non latin chars ^^ anyway, my solution is working fine (after conversion, obviously), and OP was too lazy to implement it ^^
15th Jun 2021, 3:21 AM
visph
visph - avatar
+ 3
visph i don't know, how your code is working, please give me a one example, Add your code in inside of my code, and send me example....
15th Jun 2021, 3:50 AM
𝐀𝐲𝐞𝐬𝐡𝐚 𝐍𝐨𝐨𝐫
𝐀𝐲𝐞𝐬𝐡𝐚 𝐍𝐨𝐨𝐫 - avatar
0
open calculator using Java script and type script after using the body tag in your html document.
19th Jun 2021, 4:40 PM
Shubham Bhatia
Shubham Bhatia - avatar