Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
What is core JavaScript language?
Core JavaScript is the foundation of the JavaScript language that provides the essential programming constructs and features. It represents the standard language specification that works consistently across different environments, whether in browsers, servers, or other JavaScript runtime environments.
What is Core JavaScript?
Core JavaScript includes the fundamental language features such as variables, data types, operators, control structures, functions, and objects. These core elements remain the same regardless of where JavaScript is executed.
// Core JavaScript features work everywhere
let name = "JavaScript";
let version = 2024;
let isPopular = true;
function greet(language) {
return `Hello from ${language}!`;
}
console.log(greet(name));
console.log(`Year: ${version}, Popular: ${isPopular}`);
Hello from JavaScript! Year: 2024, Popular: true
JavaScript Language Components
JavaScript consists of three main components that build upon the core language:
Core JavaScript
Core JavaScript provides the basic language syntax and built-in objects like Array, Object, Date, and Math. It supports both client-side and server-side development with consistent behavior.
// Core JavaScript objects and methods
let numbers = [1, 2, 3, 4, 5];
let doubled = numbers.map(x => x * 2);
console.log("Original:", numbers);
console.log("Doubled:", doubled);
console.log("Current date:", new Date().getFullYear());
Original: [ 1, 2, 3, 4, 5 ] Doubled: [ 2, 4, 6, 8, 10 ] Current date: 2024
Client-Side JavaScript (CSJS)
Client-side JavaScript extends core JavaScript with browser-specific APIs like DOM manipulation, event handling, and window objects. It enables interactive web pages and user interface development.
// Client-side specific features
document.addEventListener('DOMContentLoaded', function() {
let button = document.createElement('button');
button.textContent = 'Click me!';
button.onclick = function() {
alert('Button clicked!');
};
document.body.appendChild(button);
});
Server-Side JavaScript (SSJS)
Server-side JavaScript, primarily through Node.js, extends core JavaScript with server-specific modules for file system access, networking, and database operations. It enables backend development using JavaScript.
// Server-side specific features (requires Node.js)
const fs = require('fs');
const http = require('http');
const server = http.createServer((req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello from server-side JavaScript!');
});
server.listen(3000);
Key Differences
| Component | Environment | Primary Use | Special Features |
|---|---|---|---|
| Core JavaScript | Universal | Language fundamentals | Variables, functions, objects |
| Client-Side JS | Browser | Web page interaction | DOM, events, window |
| Server-Side JS | Server/Node.js | Backend development | File system, networking |
Conclusion
Core JavaScript provides the essential language features that work consistently across all environments. Client-side and server-side JavaScript extend this foundation with environment-specific capabilities for web browsers and servers respectively.
