JavaScript - Some questions about my little code. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

JavaScript - Some questions about my little code.

Hello everyone, I need some help with the following code, any help will be appreciated. The questions have been asked within the code. Thanks! https://code.sololearn.com/WLIalIN8HRDR/#js

15th Oct 2018, 1:32 PM
Bahamin Shahriari
Bahamin Shahriari - avatar
4 Answers
+ 17
Bahamin Shahriari Hi, adding parameters in function is easy, just create function and add parameter like function func(paramA, paramB){} then call func(1, "test"); Lower input = toLowerCase(); Your concatenating style is fine Semicolons in the end of objects is optional. Just write it. userChoice == null is bad; use userChoice.length === 0 instead Commas in objects are delimiters so there is no need to put them in behind last attr or method.
15th Oct 2018, 8:07 PM
r8w9
r8w9 - avatar
+ 11
Bahamin Shahriari Don't be lazy and write it manually☺
16th Oct 2018, 5:17 AM
r8w9
r8w9 - avatar
+ 1
r8w9 hello, i have made changes and added questions to the code since you visited, would be great if you could help, thanks
15th Oct 2018, 2:06 PM
Bahamin Shahriari
Bahamin Shahriari - avatar
+ 1
r8w9 Thank you for your response. I got almost all the answers except for the first question. I was using prompt function which only takes two parameters, so I wanted to get the value of rentOperation.car1 in the prompt instead writing it manually, is there any way to get variable's value inside the string?
15th Oct 2018, 8:30 PM
Bahamin Shahriari
Bahamin Shahriari - avatar