<html> <body> <script type="text/javascript"> x=5+5; document.write(x); document.write("<br />"); x="5"+"5"; document.write(x); document.write("<br />"); x=5+"5"; document.write(x); document.write("<br />"); x="5"+5; document.write(x); document.write("<br />"); </script> <p>The common rule is: If you add a number and a string, the result will be a string.</p> </body> </html>
Your Result:
Edit the code above and click to see the result.
W3Schools.com
- Try it yourself