Supercharge your development with unmatched features:
Access a full terminal environment, run Linux commands, and manage your project’s dependencies directly within the IDE.
Browse and interact with websites directly within the IDE. Supports real-time interaction with web content without leaving the workspace.
Manage your project files and directories effortlessly within the IDE. Create, edit, rename, move, and delete files—all in one place.
Experience seamless code editing with real-time syntax highlighting, tab support, and intelligent code suggestions for a smoother development workflow.
JavaScript is a versatile, high-level programming language commonly used for creating dynamic and interactive web pages. It can run on the client-side and server-side (e.g., with Node.js).
<script>
tag to write JavaScript or link an external JavaScript file.Add the following code inside a <script>
tag in an HTML file:
<script>
console.log("Hello, World!");
</script>
Open the HTML file in a browser and check the output in the browser's developer console (usually accessible with F12).
JavaScript variables are declared using var
, let
, or const
. Common data types include:
let x = 10; // Number
let y = 3.14; // Float
let name = "JavaScript"; // String
let isAvailable = true; // Boolean
console.log(`x = ${x}, y = ${y}, name = ${name}, isAvailable = ${isAvailable}`);
JavaScript supports if
, else if
, and else
statements.
let num = 10;
if (num > 0) {
console.log("Positive number");
} else if (num === 0) {
console.log("Zero");
} else {
console.log("Negative number");
}
JavaScript supports for
, while
, and for...of
loops.
for (let i = 0; i < 5; i++) {
console.log(i);
}
let count = 0;
while (count < 5) {
console.log(count);
count++;
}
Functions in JavaScript allow for reusable code blocks.
function greet(name) {
console.log(`Hello, ${name}!`);
}
greet("Alice");
Arrays in JavaScript can hold multiple values and support various methods.
let numbers = [1, 2, 3, 4, 5];
numbers.forEach(num => console.log(num));
JavaScript supports object-oriented programming using classes.
class Student {
constructor(name, age) {
this.name = name;
this.age = age;
}
displayInfo() {
console.log(`Name: ${this.name}, Age: ${this.age}`);
}
}
const s1 = new Student("John", 21);
s1.displayInfo();
JavaScript allows you to manipulate the Document Object Model (DOM).
document.getElementById("myElement").innerText = "Hello, DOM!";
JavaScript handles asynchronous tasks with Promises
and async/await
.
function fetchData() {
return new Promise(resolve => setTimeout(() => resolve("Data fetched"), 2000));
}
async function displayData() {
const data = await fetchData();
console.log(data);
}
displayData();
Popular JavaScript libraries and frameworks include: