Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5f30b51

Browse files
committed
add running-javascript
1 parent adc8b16 commit 5f30b51

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

‎running-javascript.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Running JavaScript:
2+
3+
- We can run JS on the browser's console by which we will have access to the page we are on.
4+
5+
- Also we can run it in a `script` tag:
6+
7+
```javascript
8+
<script>console.log('Heyyy');</script>
9+
```
10+
11+
Always try to have your `script` tag before the closing `body` tag, because we can access the HTML elements written above the `script` tag as they are above the JS.
12+
13+
- Also, we can run JS in another file using `script` tag with `src` attribute:
14+
15+
```javascript
16+
<script src="relative path to js file"></script>
17+
```
18+
19+
- Also we can run it via Node.js - instead of running in the context of a website we run it in an actual machine. In console, run: `node file.js`

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /