U
U
Umid2015-10-11 01:07:40
JavaScript
Umid, 2015-10-11 01:07:40

How to convert the expression PS I am writing a calculator???

Hello!
I am writing a calculator in js, and the first problem arose.
The code:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>JavaScript</title>
  <script src="jsLessons.js"></script>
</head>
<body>
  <input type="text" id="text" onchange="calcFunc(this.value)">
  <input type="button" value="Кнопка" id="button">
</body>
</html>

function calcFunc(newS){
  alert(parseInt(newS));
}

And when writing in the script in place of parseInt - Number(newS) - gives out NaN for the expression 53+65 (for example)
And when parseInt it gives out only the first number - for example for the expression 53+65 - it gives out only 53.
How can I convert from String to numeric value, the whole expression??

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question