1parseInt(value);
2
3let string = "321"
4console.log(string); // "321" <= string
5
6let number = parseInt(string);
7console.log(number) // 321 <=int
1<!-- GET VALUE/INTEGER FROM HTML TEXTBOX/<INPUT> -->
2
3<!-- First set up your input box within the <body> tag -->
4<input id="example"> <!-- you are able to set the id to whatever you like,
5 just make sure it is unique to your page and is
6 understandable -->
7
8<script>10</script>
11
12<!-- Inside the script tag, use parseInt() to grab value and assign it
13to a variable to use later -->
14<script>
15 var examplevar = parseInt(document.getElementById("example").value);
16</script>
17<!-- Make sure to set the identifier/id of the .geteElementBy tag to the id of
18the textbox you want to grab the value from, or else it will result in
19 an error message. -->
20
21<!-- You now have a variable that can be used for math equations in
22javascript -->