毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> WEB开发 >> 正文

SyntaxError: Unexpected token {

更新时间:2013-5-1:  来源:毕业论文

var getReview = function (movie) {
   
    switch(movie){
        case(Matrix){
            return"good trip out";
        }
        case(Princess Bride){
            return"awesome date night movie";
        }
        case(Welcome to America){
            return"Amjad's favorite";
        }
        case(Remember the Titans){
            return"love the sports";
        }
        case(Why do I look like ) {
           return"The Ryan and Zach story";
        }  
        毕业论文 
        case(Fighting Kangaroos in the wild){
            return "Token Australian movie for Leng";
           
        }
        fault{
        return"I don't know!";   
        }
           
        }
    };

getReview(Princess Bride);
SyntaxError: Unexpected token {
不知道哪里错了,各位给看看吧

var getReview = function (movie) {           switch(movie){         case "Matrix": //case语法错误 而且字符串要用引号括起来。             return"good trip out";                   case "Princess Bride":             return"awesome date night movie";                   case "Welcome to America":             return"Amjad's favorite";                   case "Remember the Titans":             return"love the sports";                   case "Why do I look like":            return"The Ryan and Zach story";                             case "Fighting Kangaroos in the wild":             return "Token Australian movie for Leng";                       //fault //这里是不是拼写错误?         default :         return"I don't know!";         }  };

双引号里面用单引号。。如果单引号里面用单引号需要转义

case'Why do I look like I\'m 12?': //注意要转义

1234567891011121314151617181920212223242526272829 var getReview = function (movie) {            switch(movie){         case "Matrix": //case语法错误 而且字符串要用引号括起来。             return"good trip out";                    case "Princess Bride":             return"awesome date night movie";                    case "Welcome to America":             return"Amjad's favorite";                    case "Remember the Titans":             return"love the sports";                    case "Why do I look like I'm 12?":            return"The Ryan and Zach story";                               case "Fighting Kangaroos in the wild":             return "Token Australian movie for Leng";                        //fault //这里是不是拼写错误?         default :         return"I don't know!";         }  };     getReview("Matrix"); 

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。