|
1 | 1 | # JavaScript |
2 | 2 |
|
3 | | -TODO... |
| 3 | +[JavaScript](https://developer.mozilla.org/docs/Web/JavaScript) is a versatile, interpreted programming language that powers the dynamic behavior on most websites. |
| 4 | + |
| 5 | +LiveCodes runs JavaScript natively in the browser.Since JavaScript runs in the browser, it has a host environment with access to the DOM and other Web APIs, but it does not have Node.js features such as the file system or process information. |
| 6 | + |
| 7 | +## Demo |
| 8 | + |
| 9 | +import LiveCodes from '../../src/components/LiveCodes.tsx'; |
| 10 | + |
| 11 | +export const params = { |
| 12 | + template:"Javascript", |
| 13 | + console:"open" |
| 14 | +}; |
| 15 | + |
| 16 | +<LiveCodes params={params}></LiveCodes> |
| 17 | + |
| 18 | +## Usage |
| 19 | + |
| 20 | +LiveCodes executes JavaScript directly in the browser. |
| 21 | + |
| 22 | +You can use it to test and demonstrate JavaScript code that interacts with the DOM, fetch APIs, or manipulate HTML elements dynamically. |
| 23 | + |
| 24 | +### Loading Modules |
| 25 | + |
| 26 | +Most of the core functionality in JavaScript is available directly in the browser without any additional installation. |
| 27 | + |
| 28 | +#### Standard Library |
| 29 | + |
| 30 | +JavaScript provides a standard set of built-in objects and functions which are available directly in the browser. |
| 31 | + |
| 32 | +#### External Packages |
| 33 | +To use additional functionality not included in the core language, you can import external packages (libraries) from CDN links. |
| 34 | + |
| 35 | +```js |
| 36 | +import _ from 'https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/lodash.min.js'; |
| 37 | + |
| 38 | +const arr = [1, 2, 3, 4, 5]; |
| 39 | +console.log(_.shuffle(arr)); // shuffle the array |
| 40 | +``` |
| 41 | + |
| 42 | +If you use JavaScript syntax extensions like JSX or JavaScript libraries/frameworks, you can select them directly in the programming language selection. |
| 43 | + |
| 44 | +## Language Info |
| 45 | + |
| 46 | +### Name |
| 47 | + |
| 48 | +`Javascript` |
| 49 | + |
| 50 | +### Aliases |
| 51 | + |
| 52 | +`js`,`node`,`ecmascript` |
| 53 | + |
| 54 | +### Extensions |
| 55 | + |
| 56 | +`js` |
| 57 | + |
| 58 | +### Editor |
| 59 | + |
| 60 | +`script` |
| 61 | + |
| 62 | +### Compiler |
| 63 | + |
| 64 | +JavaScript runs natively in the browser — no compilation is required. |
| 65 | + |
| 66 | +### Version |
| 67 | + |
| 68 | +Depends on the browser's JavaScript engine and its supported ECMAScript features. |
| 69 | + |
| 70 | +## Code Formatting |
| 71 | + |
| 72 | +Using [Prettier](https://prettier.io/) for code Formatting.You can format your code when saving the project, but you need to manually enable “Format on Save” in the settings. |
| 73 | + |
| 74 | +## Live Reload |
| 75 | + |
| 76 | +JavaScript code automatically reloads and executes when edited, allowing for real-time feedback. |
| 77 | + |
| 78 | +## Starter Template |
| 79 | + |
| 80 | +https://livecodes.io/?template=Javascript |
| 81 | + |
| 82 | +## Links |
| 83 | + |
| 84 | +- [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) |
| 85 | +- [Web API](https://developer.mozilla.org/en-US/docs/Web/API) |
0 commit comments