JS-prompt-输入一个数字,后台结果+10

<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>Document</title>
 </head>
 <body>
  <script>
		//1、弹出一个输入框,输入数据
		var input=window.prompt("输入一个数字:");
		//2、将输入的数据+10,并打印输出
		/*input = input + 10;
		console.log(input);*/
		//3、注销上一步,使用typeof查看数据的数据
		console.log(typeof(input));
		//4、将输入的数据转换为数字,再+10
		console.log(Number(input) + 10);
	</script>
 </body>
</html>

posted @ 2018-11-11 20:01  IndustriousHe  阅读(1218)  评论(0编辑  收藏  举报