User Input Variables (प्रयोगकर्ताहरूबाट इनपुट)
In JavaScript, we can take input from users and use it as a variable. One doesn't need to know their value to work with them.
जाभास्क्रिप्टमा, हामी प्रयोगकर्ताहरूबाट इनपुट लिन सक्छौं र यसलाई चरको रूपमा प्रयोग गर्न सक्दछौं। तिनीहरूसँग काम गर्न उनीहरूको मूल्य जान्न आवश्यक छैन।
📝 Tasks:
[ ] Write a program to take input from a user and add
10to it, and print its result.[ ] प्रयोगकर्ताबाट आगत लिन र त्यसमा
१०थप्न प्रोग्राम लेख्नुहोस्, र यसको परिणाम मुद्रण गर्नुहोस् ।
💡 Hints:
The content of a variable is determined by the user's inputs. The
prompt()method saves the input value as a string.चरको सामग्री प्रयोगकर्ताको इनपुटद्वारा निर्धारित गरिन्छ।
prompt()विधिले स्ट्रिङको रूपमा आगत मान बचत गर्दछ ।You will need to make sure that the string value is converted into an integer for calculations.
तपाईँले स्ट्रिङ मान गणनाका लागि पूर्णांकमा रूपान्तरण भएको सुनिश्चित गर्न आवश्यक छ ।
Visit the Basic Operators chapter for the type conversion of
stringtoint.स्ट्रिङलाई इन्टमा रूपान्तरण गर्ने प्रकारका लागि आधारभूत अपरेटर अध्याय मा जानुहोस् ।