I tried converting a Python program to JavaScript but I'm not getting the same result, please help... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I tried converting a Python program to JavaScript but I'm not getting the same result, please help...

I expected "958" as the result in the JavaScript code but I'm getting an object as the answer What's wrong with my JavaScript code? https://code.sololearn.com/cdz8QCS9MNlP/?ref=app https://code.sololearn.com/cS1b9F9SuSYW/?ref=app

8th Oct 2022, 4:41 PM
eMBee
eMBee - avatar
4 Answers
+ 2
New node creation : just do like add_at_front(data) { this.head = new node(data,this.head); } curr.next = new node(data);
8th Oct 2022, 4:50 PM
Jayakrishna 🇮🇳
+ 1
Jayakrishna🇮🇳 thank you for the insight Now I'm trying to make the output be on a straight line, just the way I recently edited it in python. I've made an attempt for that of JavaScript but is there a better way it can be written to make it similar to the way it was written in python to make the output be on a straight line?
8th Oct 2022, 7:09 PM
eMBee
eMBee - avatar
+ 1
You already done it..!?! Same output. You're welcome..
8th Oct 2022, 7:46 PM
Jayakrishna 🇮🇳
+ 1
Alright Sir/Ma, thank you Jayakrishna🇮🇳
8th Oct 2022, 7:48 PM
eMBee
eMBee - avatar