30 AnswersNew Answer
lololearn you could just convert number to BigInt(number) then your function would process large number without issue. https://code.sololearn.com/W0mGYboi2Ci0/?ref=app
What exactly you need, the red numbers to be the same result as the green numbers?
Yes, putting the number inside quotes as bobbie say https://code.sololearn.com/WMWO0Nzqx3ul/?ref=app
Use built in method, BigInt for unsafe number calculation https://code.sololearn.com/W3eNWFfXF1Zu/?ref=app
lololearn This worked (inside the for loop) replace result*=i with: result=BigInt(result)*BigInt(i); most likely conversion issue only reason that the variable "i" also needs casting to BigInt is that you cannot mix BigInt with a primitive integer (try it and see the error that is thrown)
Burey you are an undisputed GENIUS! I researched that few thought it's even possible!
Use Number.isSafeInteger method to check for integer is safe or unsafe. https://code.sololearn.com/W6SVyP904LOB/?ref=app
Thanks Calviղ! I love learning new things from you! PS why is my php not working in my web code?
lololearn you can convert it back and forth from string as needed. Please give us an example of how you intend to use it if you need more help.
Have you tried putting quotes " " around it?
lololearn Also take a look into this library: https://github.com/rauschma/strint it was mentioned in the second article and was not so easy to find 😅 Take into account it does not seem to work in SL playground edit: another option is to try using a library such as https://mathjs.org for the operations
Burey great to see you here! I found a PHP and a Ruby solution I thought we could just plug one of those in the HTML for our extended brain but I keep messing it up? https://code.sololearn.com/Wa6L1S2XGGbO/?ref=app https://code.sololearn.com/w766RX55RQ6L/?ref=app https://code.sololearn.com/cXd0I7p4Me1E/?ref=app
😱 than you It s working !
The article explains it very well :)
Thank you all ! Burey you are a genius, Calviղ is perfect! I met this problem several times and each time I was stuck on the exercise. Sololearn has the best community, it's incredible sharing between members 👍 👏👏👏 🥇🏆
Calviղ An idea why this code with BigInt does not give the right result. Thx https://code.sololearn.com/W21sTojWav3F/?ref=app
Burey Yes it makes sense! I am a beginner in JS but I found a master 👏👏👏 Thank you so much