首页 新闻 会员 周边 捐助

javascript高级程序设计中的一个例子,求解释。。。

0
[已解决问题] 解决于 2014-11-11 18:13
1 var name = "The Window";
2 
3 var object = {
4     name: "My object",
5     getName: function(){
6         return this.name
7     }
8 }
9 (object.getName = object.getName)();  //The Window
复制代码
  1. 第9行在Chrome会出现

    Uncaught TypeError: Cannot read property 'getName' of undefined 

    而IE11下没问题,为什么????

而改成

consolo.log((object.getName = object.getName)( ));,结果一致且没提示错误
问题补充:

如果是实现的不同。。。就不深究了。。。

Naux的主页 Naux | 菜鸟二级 | 园豆:202
提问于:2014-11-10 22:19
< >
分享
最佳答案
0

区别是,getName function return 语句多加了个分号。

奖励园豆:5
南昌炒粉 | 小虾三级 |园豆:760 | 2014-11-11 01:34

新手伤不起呀。。。。

XiaoFaye | 园豆:3087 (老鸟四级) | 2014-11-11 05:58

好像是第8行右大括号忘了加分好,而不是return语句,return那段会自动加分号

Naux | 园豆:202 (菜鸟二级) | 2014-11-11 18:09

Naux | 园豆:202 (菜鸟二级) | 2014-11-11 18:18
其他回答(1)
0

1. If you?re less than 5?4? (petite), you?ll look perfect in a wedding gown with a high neckline, full-length sheath, short sleeves, elbow-length gloves, floor-length veil and no train. This style will create the illusion of height. 

2. If your height and weight are average (5?5? to 5?8?), simply select the style that will go with your groom?s height, e.g., if he?s tall, then add some height to yourself by choosing a wedding gown that will create the illusion of height. 

3. If you?re over 5?9? (tall), you?ll look perfect in a wedding gown with a low neckline, drop waist, a wide belt and full sleeves. This style will make you look a little less tall. 4. If you?re slim, you can either emphasize it or make yourself more filled out. To emphasize, follow the tips for petite brides. To look fuller or filled out, go with full velvet or damask skirt and sleeves. If you?re on the heavy side, go with a high waist gown and follow the tips for petite brides. 

5. If you?re big on top, you?ll look perfect in a V- or high neck gown. Avoid too much beadwork on the bodice. If you?re pear shaped, choose a wedding gown with big sleeves or go with a flared skirt. 

Just remember, the most important part about your wedding dress
wedding dresses,cheap wedding dress,designer wedding dress,bridal gowns,bridal dresses,wedding gowns,wedding dresses
should  be how you like it and how you feel in it. It's your day, make it magical, and wear what makes you happy.... and that will top everything.

wedding | 园豆:208 (菜鸟二级) | 2014-11-11 12:08
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册