You need to use parseInt on no1
and no2
like follows:
var noO = prompt("please enter a number:");
var noT = prompt("please enter a second number:");
var no1 = noO;
var no2 = noT;
var res = parseInt(no1, 10) + parseInt(no2, 10);
alert("the adiition of thoes 2 numbers is: " + res);
EDIT
In addition, it is probably worth noting that parseInt
should always be used with a radix
specified based on the required behaviour:
An integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the above mentioned string. Specify 10 for the decimal numeral system commonly used by humans. Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. Different implementations produce different results when a radix is not specified, usually defaulting the value to 10
E.g. a radix of 10 indicates to convert from a decimal number, 8 octal, 16 hexadecimal.. There are many examples on the web page link above.