I have errors in my JS part. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I have errors in my JS part.

I have errors in my JS part, can someone check my code and tell me what changes must I do ? My project : https://code.sololearn.com/W01KYK017LSt/?ref=app

14th Feb 2017, 12:04 PM
San_Antonio
San_Antonio - avatar
7 Answers
+ 5
your problem is: the function change_quantity is inside the function change_product, so you can't call it just by its name I would suggest you to rewrite your javascript, and make every function separate, it's not a good idea to put functions inside other functions, however if you do the you need to use the word 'new' and every function and/or variable needs to be initialized with 'this' for example: this.var = 5; this.funcName = function (){} hope this helps
14th Feb 2017, 1:06 PM
Kamil
Kamil - avatar
+ 4
No problem!! (if you pay me well 😂😂)
14th Feb 2017, 1:45 PM
Kamil
Kamil - avatar
+ 3
Thank you, I understand now ^^ oups fail LOL, Thann you for your advises Kamil :)
14th Feb 2017, 1:14 PM
San_Antonio
San_Antonio - avatar
+ 3
I've just fixed the problem thanks to you Kamil, I enjoy jour advises, Thanks :)
14th Feb 2017, 1:40 PM
San_Antonio
San_Antonio - avatar
+ 2
It's not showing any errors🤔
14th Feb 2017, 12:37 PM
Kamil
Kamil - avatar
+ 2
Press a buy button, an overlay will appear, and select a quantity different from 1, an error will appear, and I don't know how to correct it.
14th Feb 2017, 12:43 PM
San_Antonio
San_Antonio - avatar
+ 2
At the end I want to display the final price the user has to pay ( product's price * quantity ) but there is an error line 32 in JS, and I would like to correct this error before finishing the rest.
14th Feb 2017, 12:50 PM
San_Antonio
San_Antonio - avatar