+ -
当前位置:首页 → 问答吧 → 唔明呢2句野想点(新手学javascript)

唔明呢2句野想点(新手学javascript)

时间:2014-05-02

来源:互联网

// Declare a variable on line 3 called
// myCountry and give it a string value.

请问各位大大佢想我做咩呢
试左好多次都唔得....

作者: z86566312   发布时间: 2014-05-02

//
//
var myCountry = "Hong Kong";

作者: city__hunter   发布时间: 2014-05-02

已经试过 唔得....

作者: z86566312   发布时间: 2014-05-02

post d code 黎睇下!

作者: 烟民比食屎9更贱   发布时间: 2014-05-02

// Declare a variable on line 3 called
// myCountry and give it a string value.
var myCountry = 'Hong Kong';

// Use console.log to print out the length of the variable myCountry.
console.log( 'myCountry'.length );

// Use console.log to print out the first three letters of myCountry.
console.log( 'myCountry'.substring(0,3) );

请问边到错“?

作者: z86566312   发布时间: 2014-05-02

// Declare a variable on line 3 called
// myCountry and give it a string value.
var myCountry = 'Hong Kong';

// Use console.log to print out the length of the variable myCountry.
console.log( 'myCountry'.length );

// Use console.log to print out the first three letters of myCountry.
console.log( 'myCountry'.substring(0,3) );

请问边到错左”?

作者: z86566312   发布时间: 2014-05-02

听闻 console.log( ) 只用於 Firefox., IE 用唔到。试下用 alert( ) 或 document.write( ) 应该无问题。

作者: me888   发布时间: 2014-05-02

string declare 系 " " 仲有 'myCountry' 错, 不用 ' ' 只用 myCountry.length, 和 console.log(myCountry.substring(0,3) );

[ 本帖最后由 me888 於 2014-4-12 01:19 AM 使用 编辑 ]

作者: me888   发布时间: 2014-05-02

都系唔得喔....
http://www.codecademy.com/
学习 javaScript 25/28
你试试.....
同埋我发现 起个个 webside 用 ' ' 同 “ ” 无分别....

作者: z86566312   发布时间: 2014-05-02

咩网站黎

有人咁样学程式嘅咩?

作者: Susan﹏汪汪   发布时间: 2014-05-02

个网站叫 codecademy
无办法啦,新手=,.="

作者: z86566312   发布时间: 2014-05-02

复制内容到剪贴板代码:<html>
<head>
</head>
<body>

<script type="text/javascript">

// Declare a variable on line 3 called
// myCountry and give it a string value.
var myCountry = "Hong Kong";

// Use console.log to print out the length of the variable myCountry.
console.log( myCountry.length );

// Use console.log to print out the first three letters of myCountry.
console.log( myCountry.substring(0,3));

</script>
</body>
</html>
[ 本帖最后由 me888 於 2014-4-12 10:29 AM 编辑 ]

作者: me888   发布时间: 2014-05-02

因为用了 console.log, 所以必须运行时在 Browser中

- Google Chrome 要再按 F12

- Firefox 直接按 F12

即可.

如果唔想按 F12, 改 console.log 做 document.write 即可

[ 本帖最后由 me888 於 2014-4-12 08:25 AM 编辑 ]

作者: me888   发布时间: 2014-05-02

已经OK“~~~
唔该哂~~~~

作者: z86566312   发布时间: 2014-05-02