Welcome to the JavaScript Course Repository! This repository contains code snippets and examples for learning core JavaScript concepts. Each topic is organized sequentially for a smooth learning experience.
This repository covers essential JavaScript topics with simple and well-documented code examples:
-
Arithmetic Operations
Learn basic arithmetic operations like addition, subtraction, multiplication, and division.
File:1. Arithmetic.js
-
If-Else Statements
Understand conditional statements to control the flow of your program.
File:2. If Else.js
-
For Loops
Master iterative programming with for loops.
File:3. For Loop.js
-
While Loops
Explore how while loops work for repetitive tasks with condition checks.
File:4. While Loop.js
-
Do-While Loops
Discover how do-while loops ensure code runs at least once before condition checks.
File:5. Do While Loop.js
-
For-of Loop
Learn how to iterate over iterable objects like arrays and strings using thefor-of
loop.
File:6. For-of loop.js
-
Var and Confirm
Understand the use ofvar
and how to implementconfirm
dialogs for user interaction.
File:7. Var and Confirm.js
-
Data Types Introduction
Introduction to JavaScript's data types, including primitives and reference types.
File:8. Data Types Introduction.js
-
Difference between '==' and '==='
Learn the key differences between loose equality (==
) and strict equality (===
) in JavaScript.
File:9. Difference between '==' and '==='.js
-
Function Basics
Get started with JavaScript functions, including declaration, invocation, and parameters.
File:10. Function Basics.js
-
Function Arithmetic
Understand how to perform arithmetic operations within functions and return results.
File:11. Function Arithmetic.js
-
Arrow Functions
Learn the modern syntax for writing concise functions with arrow functions (=>
).
File:12. Arrow Function.js
-
Typeof
Explore how thetypeof
operator is used to check data types in JavaScript.
File:13. Typeof.js
-
String Basics and Manipulation
Dive into string operations like concatenation, slicing, and methods for manipulation.
File:14. String Basics and Manipulation.js
-
String Methods Example
Learn how to use various built-in JavaScript string methods liketoLowerCase()
,length
,slice
,concat
,trim
,indexOf
,toUpperCase()
, andreplace()
.
File:15. String Methods Example.js
-
Array Basics
Explore how to work with arrays, including creation, accessing elements, and common operations.
File:16. Array.js
-
Array Methods
Explore essential array methods in JavaScript, including:toString()
,join()
,pop()
,push()
,shift()
,unshift()
,delete
,concat()
,sort()
,compare
,reverse()
,splice()
,slice()
.
File:26. Array Methods.js
-
Map
Understand how to use theMap
object in JavaScript for key-value pair operations and efficient lookups.
File:17. Map.js
-
Filter
Learn how to use thefilter
method to create a new array containing elements that meet specific conditions.
File:18. Filter.js
-
Reduce
Master thereduce
method to execute a reducer function on each array element, resulting in a single output value.
File:19. Reduce.js
-
Alert
Explore how to use thealert
method to display pop-up messages to users in the browser.
File:20. Alert.js
-
Confirm
Learn how to use theconfirm
method to prompt users with a confirmation dialog and handle their responses.
File:23. Confirm.js
-
Math.random()
Learn how to useMath.random()
to generate random numbers and implement randomness in your JavaScript programs.
File:21. Math.random().js
-
DOM Basics
Understand the Document Object Model (DOM) and learn how to interact with HTML elements using JavaScript.
File:22. DOM Basics.js
-
Child Element
Understand how to access and manipulate child elements in the DOM using properties likechildren
,firstChild
, andlastChild
.
File:24. Child Element.js
-
Table in DOM
Learn how to view HTML tables using JavaScript, including adding rows, columns, and dynamic data.
File:25. Table in DOM.js
-
For Each Loop
Learn how to use theforEach
method to iterate over array elements and execute a callback function on each item.
File:27. For Each Loop.js
-
Console Objects
Explore various console object methods likeconsole.log
,console.warn
,console.error
,console.time
, and more to debug and display information in the browser console.
File:28. Console Objects.js
-
Element ID Classes Using Console
Learn how to access and manipulate HTML elements using theirID
andClass
selectors through the console with methods likegetElementById
andgetElementsByClassName
.
File:29. Element ID Classes Using Console.js
-
Synchronous & Asynchronous
Understand the difference between synchronous and asynchronous programming in JavaScript, including concepts like the event loop, callbacks, promises, andasync/await
.
File:30. Synchronous & Asynchronous.js
-
Query Selector
Learn how to usequerySelector
to select a single element andquerySelectorAll
to select multiple elements using CSS-style selectors in JavaScript.
File:31. Query Selector.js
- Clone the repository:
git clone https://github.com/Divyamsharma-18/Javascript-Code.git
- Open any
.js
file in your preferred code editor, such as Visual Studio Code. - Run the code in your browser console or using Node.js:
node "1. Arithmetic.js"
- Experiment with the code and modify it to deepen your understanding!
- Basic knowledge of programming concepts is helpful but not required.
- A code editor like Visual Studio Code.
- Node.js (optional) for running JavaScript locally.
Contributions are welcome! If you'd like to:
- Add more examples or topics.
- Fix bugs or improve code clarity.
- Suggest improvements or provide feedback.
Feel free to open an issue or submit a pull request. Every contribution is appreciated, no matter how small.
If you have any questions, suggestions, or feedback, feel free to connect with me:
- Twitter: @Heydivyamsharma
- LinkedIn: Divyam Sharma
- GitHub: Divyam Sharma
- Email: [email protected]
Thank you for checking out this repository! I hope you find the examples and code helpful in your JavaScript learning journey. Feel free to explore the topics, contribute, or reach out with any questions. Happy coding!