I need One Calculation. In this code. | Sololearn: Learn to code for FREE!

+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.

6/14/2021 7:05:10 PM

Ayesha Noor

7 Answers

New Answer

+4

https://code.sololearn.com/Wf08x30GdFI5/?ref=app

+4

Thanks So Much..

+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; }

+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 ^^)

+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 ^^

+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....

0

open calculator using Java script and type script after using the body tag in your html document.