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
/* | |
請完成以下 API 設計,讓你的程式可以執行以下程式碼, | |
並且得到預期的結果。串接 add 的次數沒有上限,最後一個 API 是 result() 才會回傳結果。 | |
$(1).add(2).add(3).add(99).result() === 105 | |
$(1).add(2).add(3).result() === 6 | |
*/ | |
var $ = function(num) { | |
return { | |
add: function(numadd) { return $(num+numadd); }, | |
result: function() { return num; } |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimun-scale=1.0"> | |
<title>Document</title> | |
<style type="text/css"> | |
div { | |
width: 300px; | |
height: 200px; |
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 doGet(e) { | |
//JSON.stringify(name) | |
if(typeof e !== 'undefined') { | |
var params = e.parameter; | |
var name = params.name; | |
var drinkIndex = params.drinkindex; | |
var drink = params.drink; | |
var drinkPrice = params.drinkprice; | |
var sugar = params.sugar; | |
var ice = params.ice; |
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
@IBAction func switchAction(_ sender: UISwitch) { | |
print("switchGood\(switchGood.isOn), switchFast\(switchFast.isOn), switchCheap\(switchCheap.isOn)") | |
switch sender.tag { | |
case 0: //switchGood | |
setupSwitchsStatus(labelSource: labelGood, switchSource: switchGood, labelDesignated1: labelFast, switchDesignated1: switchFast, labelDesignated2: labelCheap, switchDesignated2: switchCheap) | |
case 1: //switchFast | |
setupSwitchsStatus(labelSource: labelFast, switchSource: switchFast, labelDesignated1: labelGood, switchDesignated1: switchGood, labelDesignated2: labelCheap, switchDesignated2: switchCheap) | |
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
switch sender.tag { | |
case 0: //switchGood | |
if (sender.isOn == true) { | |
labelGood.alpha = 1.0 | |
if (switchFast.isOn == true) { | |
switchCheap.setOn(false, animated: true) | |
labelCheap.alpha = 0.5 | |
} else if (switchCheap.isOn == true) { | |
switchFast.setOn(false, animated: true) | |
labelFast.alpha = 0.5 |