Is there a way to create and run javascript in Chrome?

后端 未结 9 2220
生来不讨喜
生来不讨喜 2020-12-13 06:21

Is there a way, like an extension or application, in Chrome to create and run .js files in Chrome?

9条回答
  •  感动是毒
    2020-12-13 07:20

    if you don't want to create an explicitly a js file but still want to test your javascript code, you can use snippets to run your JS code.

    Follow the steps here:

    1. Open Dev Tools
    2. Go to Sources Tab
    3. Under Sources tab go to snippets, + New snippet
    4. Past your JS code in the editor then run command + enter in Mac. You should see the output in console if you are using console.log or similar to test. You can edit the current web page that you have open or run scripts, load more javascript files. (Just note: this snippets are not stored on as a js file, unless you explicitly did, on your computer so if you remove chrome you will lose all your snippets);
    5. You also have a option to save as your snippet if you right click on your snippet.

提交回复
热议问题