iT邦幫忙

第 11 屆 iThome 鐵人賽

DAY 1
1
Modern Web

JS 學習歷程系列 第 1

梁靜茹給的勇氣 - 讓我來分享 VSCode * JS 寫出人生第一個 "Hello World"

  • 分享至 

  • twitterImage
  •  
  1. 首先,我們需要透過 VS Code 建立 2 個新檔案取名為「index.html」及「all.js」,再創建一個「HelloWorld」資料夾,並將「index.html」檔案存在此資料夾中,「HelloWorld」的資料夾中再開一個名為「js」的資料夾,並將「all.js」存在 js 的資料夾中。
    https://ithelp.ithome.com.tw/upload/images/20190830/20119922Q0wsmLS1tK.jpg

  2. 把 JS 渲染到 HTML 中:在 HTML 的 </body> 上面加入 <script src="js/all.js"></script>
    https://ithelp.ithome.com.tw/upload/images/20190830/20119922VA8oxvanLk.png

  3. 在 JS 中:加上 alert('Hello World');
    https://ithelp.ithome.com.tw/upload/images/20190830/20119922XOlj9NeVlH.png

  4. 來瀏覽器看結果吧!
    https://ithelp.ithome.com.tw/upload/images/20190830/201199228CuMWEY3KU.png

  5. 看到結果是不是很讓人開心(灑花),終於踏入 JS 第一步啦!讓我們往下繼續快樂學 JS 吧!


下一篇
與 JS 確認過眼神 - 宣告變數、把 JS 加入你頁面 (一)
系列文
JS 學習歷程30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言