1、求两个数的最大值
2、求1到100的相加和
3、截取字符串的每一个字符。

解决方案 »

  1.   


    <script type="text/javascript">
    alert(Math.max(1,4)); var add = function(n) {
    return n == 1 ? 1 : n + add(n - 1);
    }
    alert(add(100)); var str = 'abddeer';
    for(var i = 0, len = str.length; i < len; i++) {
    alert(str.charAt(i));
    }
    </script>
      

  2.   


    // 1 内置对象 Math 有成员方法 max
    var max = Math.max(aNumber, bNumber);
    // 2 用公式
    var sum = (1 + 100) * 50;
    // 3
    var theCharacter = theString.charAt(index);  // 取 theString 的第 index 个字符.
    // 如 theString.charAt(0); theString.charAt(1); ... theString.charAt(n);  等// 遍历的话, 用循环.
    var theString = "我是字符串";for (var i=0; i<theString.length; i++) {
        document.write("第 " + i + " 个字符是:" + theString.charAt(i) + "<br/>");
    }
      

  3.   

    优秀网站源码、编程源码下载网站大集中
    1.51源码:http://www.51aspx.com/2. 源码之家:http://www.codejia.com/3.源码网:http://www.codepub.com/4.虾客源码:http://www.xkxz.com/5. 多多源码:http://www.morecode.net/6.洪越源代码:http://www.softhy.net/7.锋网源码:http://www.fwvv.net/8.代码爱好者:http://www.codefans.com/9. 爱源码:http://www.aiyuanma.com/10.酷源码:http://www.kyuanma.com/11. 搜源码:http://www.soucode.com/12.拉基源码:http://www.lajicode.com/13. 源码开发网:http://www.codedn.com/14.源码天空:http://www.codesky.net/15. 源码吧:http://www.asp88.net/16.绿色源码:http://code888.cn/17.9号源码中心:http://www.9code.com/18.网馨源码:http://www.asppsa.com/20. 源码天下:http://www.pccode.net/21.需要源码:http://www.needcode.cn/22. 华夏源码:http://www.haocpu.com/23.天新网:http://codes.21tx.com/24. 源码网:http://www.yuanma5.com/25.无忧源码:http://www.5uym.com/26. 中国下载站:http://www.cnz.cc/27.资源吧:http://www.ziyuan8.com/28. 启明星源码:http://www.codewww.com/29.我要源码:http://www.xia51.com/30. 清秋源码:http://www.asp678.com/
        自己多看  多写些  慢慢就会了