最省納智捷1年新車83萬起5檔高息股比定存強10倍輕忽小中風,當心變殘障晚會結束續攤大腸花 學...
2012-04-14 08:44:00 人氣(82) | 回應(0) | 推薦(0) | 收藏(0) 上一篇 | 下一篇

[JavaScript] Defining Functions

0
收藏
0
推薦

var hello = function () {
  // Print hello on the console.
  console.log("i am saying hello");
};

hello();
hello();


var hi = function () {
  console.log("hi");
};

hi();

var myFirstFunction = function() {
    console.log("yourName");
}
myFirstFunction();

var fullName = "";
var name;
var firstLetter;
/*
   fixName function definition should go here.
*/
var fixName = function() {
    /***** Begin repeated code block *****/
    firstLetter = name.substring(0, 1);
    name = firstLetter.toUpperCase() + name.substring(1);
    fullName = fullName + " " + name;
    /***** End repeated code block *****/
}
name = prompt("Enter your first name (all in lower case):");
fixName();
name = prompt("Enter your second name (all in lower case):");
fixName();

console.log("And your full name is:" + fullName);

台長:Morris
人氣(82) | 回應(0)| 推薦 (0)| 收藏 (0)| 轉寄
全站分類: 不分類 | 個人分類: [學習]JavaScript |
此分類下一篇:[JavaScript] Variables in functions

我要回應
是 (若未登入"個人新聞台帳號"則看不到回覆唷!)
* 請輸入識別碼:
請輸入以下數字 (ex:123)

(有*為必填)
詳全文