在瀏覽器與 node.js 運行 javascript


Posted by ericcch24 on 2020-06-22

瀏覽器

  • 用 git 建立一個 html 的檔案
  • vim 執行
  • 在 html 檔案中撰寫,並於兩個標籤間撰寫JavaScript程式碼。例如:
    <script>
    console.log("hello world")
    </script>
    
  • 存檔後用瀏覽器開啟此檔,F12 就看到上面程式碼的輸出結果

node.js

  • 用 git 建立一個 javascript 的檔案
  • 在裡面輸入
    console.log("hello world")
    
  • 在 git 輸入 node 檔名.js 即可輸出檔案的內容
    (或是直接在 git 輸入 node 也可以直接運行)

#WeeK2







Related Posts

Airflow 動手玩:(七)Airflow Best Practices

Airflow 動手玩:(七)Airflow Best Practices

JavaScript If /else -如果我不會寫程式,你還會愛我嗎?

JavaScript If /else -如果我不會寫程式,你還會愛我嗎?

AppWorks School Batch #16 Front-End Class 學習筆記&心得(駐點階段一:指定練習專案:STYLiSH)

AppWorks School Batch #16 Front-End Class 學習筆記&心得(駐點階段一:指定練習專案:STYLiSH)


Comments