This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<el-select v-model="selectedLanguageModel" placeholder="Please Select"> | |
<el-option | |
v-for="(item) in LayoutLanguages" | |
:key="item.param" | |
:label="item.title" | |
:value="item.param" | |
> | |
</el-option> | |
</el-select> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//計算質數數量,並印出所有結果 | |
function isPrime(n){ | |
if(n===1) return false | |
for(var i=2; i<=Math.sqrt(n); i++){ | |
if(n%i===0){ | |
return false | |
} | |
} | |
return true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//印出多個星星(巢狀迴圈), console.log | |
function stars(n){ | |
for(var i=1; i<=n; i++){ | |
var result = '' | |
for(var j = 1; j<=i; j++){ | |
result += '*' | |
}console.log(result) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*判斷第一位是否為大寫字母*/ | |
function isUpperCase(str){ | |
var key = str[0] | |
return key >= "A" && key <= "Z" | |
} | |
console.log(isUpperCase("Abcd")) | |
/*判斷第一個大寫字母的位置,並回傳其位置*/ | |
function position(str){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*debugger 除錯用& do/while */ | |
var i = 1 | |
debugger | |
do { | |
console.log(i++) | |
}while(i <= 100) | |
console.log("Finished!") | |
/*for loop 範例*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/if,else if,else 判斷式/ | |
var score = 40 | |
if (score >= 70){ | |
console.log('Perfect!') | |
}else if (score >= 60){ | |
console.log('Good!') | |
}else if (score >= 50){ | |
console.log('OK!') | |
}else{ | |
console.log('See u next time!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .reverse 的用法,倒轉字串 | |
a = "simultaneously" | |
puts a.reverse | |
# .upcase & .downcase,轉換大小寫 | |
a = "simultaneously" | |
puts a.upcase | |
puts a.downcase | |
# =begin & =end 搭配,將一個範圍裡的 Code 都不被解讀。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#以下為 Array 應用 | |
#使用者輸入 | |
puts "Hi, please enter a sentence." | |
sentence = gets.chomp | |
#分拆句子結構 (拆字串&序號) | |
sentence_split = sentence.split(" ") | |
sentence_index = (0..sentence_split.length-1).to_a | |
#取得每項字母長度 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#使用者輸入正確性測試 | |
puts "Please enter an integer (>=0)." | |
number = gets.chomp | |
#測試使用者的輸入是否為正整數 or 0 (此時為字串) | |
while number.match (/\D/) | |
puts "Please enter a correct integer again." | |
number = gets.chomp | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Contact Form 7 表格 RWD */ | |
.wpcf7-form input[type="text"], input[type="email"], input[type="tel"] | |
{ | |
width:100% !important; | |
} |
NewerOlder