## Chapter 1 : Say Hello to Javascript ### 1.1 What is Javascript? JavaScript is a high-level programming language that makes websites more interactive. Javascript most popular languages for web development, providing additional logic and functionality. Usually JavaScript is often found together with HTML, and CSS. However, now JavaScript is developed and found as a widely used Scripting Language, also JavaScript is used as a DOM (Document Object Model). For Scripting Language, JavaScript can be used outside the browser with Node.js. As a scripting language, its code does not need to be compiled and translated by an interpreter, making it possible to write programs with minimal code. For example, just one line of code can display "Hello, World!" on screen. ```javascript console.log("Hello World"); ``` Output : ``` Hello World ``` Wanna Try? Click here [1.1-Helloworld.js](https://github1s.com/hilmimusyafa/dicoding-course-introductiontojavascript/blob/main/Material%20%26%20Code/Chapter%201%20-%20Introduction%20to%20JavaScript/1.1-Helloworld.js) ### 1.2 History of Javascript JavaScript, created by Brendan Eich in just 10 days in May 1995 while he was working at Netscape Communications Corporation, has a storied history as one of the most popular programming languages in the world. Initially named Mocha, it was soon renamed to LiveScript and finally to JavaScript, reflecting Netscape's desire to capitalize on the burgeoning popularity of Java. In 1996, JavaScript was submitted to ECMA International for standardization, resulting in the first edition of the ECMAScript (ES) standard in 1997. This standardization helped ensure consistency across different web browsers, fostering wider adoption. Over the years, JavaScript has evolved significantly: - 1999 (ES3): The third edition of ECMAScript introduced features like regular expressions, better string handling, and more robust error handling. - 2009 (ES5): The fifth edition brought improvements such as strict mode, JSON support, and more array methods, enhancing developer productivity and code reliability. - 2015 (ES6/ECMAScript 2015): This landmark update introduced many modern features, including let and const for variable declaration, arrow functions, template literals, classes, and modules. It marked a significant shift in JavaScript development, making it more powerful and easier to use for complex applications. - Since ES6, JavaScript has continued to evolve with annual updates that introduce new features and improvements, such as async/await for better asynchronous programming, and other syntax enhancements. JavaScript is now a ubiquitous language used for both client-side and server-side development (thanks to Node.js) and is a cornerstone of web development, enabling dynamic and interactive web applications. ### 1.3 Why Learn JavaScript? JavaScript is important to master for web developers, both front-end and back-end. Some advantages of JavaScript: - Versatile - Easy to Learn - Large Community - Career Potential ### 1.4 What is JavaScript used for? 1. **Web Development** : JavaScript is primarily used to create interactive and dynamic web pages. It enables client-side scripts to interact with the user, control the browser, and alter document content that is displayed. 2. **Server-Side Development** : With Node.js, JavaScript can be used for server-side scripting to build scalable network applications. This allows developers to use JavaScript for both frontend and backend development. 3. **Mobile App Development** : Frameworks like React Native and Ionic enable developers to create mobile applications for iOS and Android using JavaScript. 4. **Game Development** : JavaScript is used to create web-based games using libraries and frameworks like Phaser and Three.js. 5. **Desktop Applications** : JavaScript can be used to build cross-platform desktop applications with frameworks like Electron. Web Server Management: Tools like Express.js allow JavaScript to manage web servers efficiently. 6. Machine Learning: Libraries like TensorFlow.js bring machine learning capabilities to JavaScript, enabling in-browser model training and deployment. 7. API Integration: JavaScript is often used to interact with APIs, allowing web applications to fetch and send data to and from servers. 8. Automation and Scripting: JavaScript can automate repetitive tasks and run scripts within various environments, including browsers and Node.js. ### 1.5 Comparison JavaScript with Other Language Here's comparison for JavaScript with other popular language : Output Target: ``` Hello World! ``` Go Language : ```go package main import "fmt" func main() { fmt.Println("Hello World") fmt.Println("Hilmi Musyafa") } ``` C++ : ```cpp #include <iostream> int main() { std::cout << "Hello World!" << std::endl; std::cout << "Hilmi Musyafa" << std::endl; return 0; } ``` Java : ```java public class Main { public static void main(String[] args) { System.out.println("Hello World!"); System.out.println("Hilmi Musyafa"); } } ``` JavaScript : ```javascript console.log("Hello World!"); console.log("Hilmi Musyafa"); ``` See it easy right? JavaScript only 2 line that's why JavaScript is simple.