Skip to content

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy