Skip to content

Instantly share code, notes, and snippets.

@showlovezz
Last active February 9, 2020 13:29
Show Gist options
  • Save showlovezz/6333512bb8c562de1ba590d57d93f6e2 to your computer and use it in GitHub Desktop.
Save showlovezz/6333512bb8c562de1ba590d57d93f6e2 to your computer and use it in GitHub Desktop.
鼠年全馬鐵人挑戰 - 1-2
status = 'failed'; // 全域變數
function getStatus() {
status = 'ok'; // 區域變數
return status
}
console.log(getStatus()) // 印出 ok
console.log(status) // 預期要印出 failed,結果卻印出 ok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment