首页 > 代码库 > 生成500个0-1000的随机数&&数组查找—小练习

生成500个0-1000的随机数&&数组查找—小练习

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><script type="text/javascript">window.onload = function (){    var obody = document.getElementsByTagName(‘body‘)[0];    for (var i = 0; i < 550; i++)    {                obody.innerHTML += Math.round(Math.random()*1000)+ ‘ ‘;            }} </script><title>无标题文档</title></head><body></body></html>
<!doctype html><html><head><meta charset="utf-8"><title>无标题文档</title><script type="text/javascript">window.onload = function (){    var arr = [1,2,3,4,5,6,7,8,9];    var num = 3;    alert(arr.join(‘‘).indexOf(num));};</script></head><body></body></html>

 

生成500个0-1000的随机数&&数组查找—小练习