MERN-Stack-with-GIT
MERN-Stack-with-GIT
• Development Setup:
The following tools must be installed on your laptops:
1. IDE: Visual Studio Code
2. Postman
3. Node LTS Version
4. Git
5. MongoDB Compass
// 1. Functions:
// 1.1. Normal Function:
function add(a,b) {
console.log(a+b)
} OUTPUT:
add (6,9)
// 1.2. Arrow Function:
const add2 = (a,b) => {
console.log(a+b)
}
add2 (6,9)
const showName = (name) => {
console.log ("Hello"+" "+name)
}
showName ("World")
// 2. Arrays
const thisArray = [1, 2, 3, 4, 5]
for (let i=0; i<thisArray.length; i++) {
console.log(thisArray[i])
}
// Using JS methods
// 2.1. map
const newAr = thisArray.map(item => item*2)
console.log(newAr)
const filteredArray = thisArray.filter(item => item < 3)
console.log(filteredArray)
Index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Document</title>
</head>
<body>
<div>
<h1 id="heading1">This is a static Heading1</h1>
<button id="btn">Click Me</button>
</div>
<script src="./Script.js"></script>
</body>
</html>
Script.js
alert("This is an alert !")
const heading1 = document.getElementById("heading1")
heading1.textContent = "This is a dynamic Heading1"
heading1.style.color = "purple"