FSD lab Manual 2025 (2)
FSD lab Manual 2025 (2)
S J C INSTITUTE OF TECHNOLOGY
FULLSTACK DEVELOPMENT
INTEGRATED LAB MANUAL
S.J.C.INSTITUTE OF TECHNOLOGY
DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
CHICKBALLAPUR -562101
During the Year: 2025
FSD Laboratory
2025
Content
Exp. List of Programs
No.
1. 1a) Write a script that Logs “Hello, World!” to the console. Create a
script that calculates the sum of two numbers and displays the result
in an alert box.
1b) Create an array of 5 cities and perform the following operations:
Log the total number of cities. Add a new city at the end. Remove the
first city. Find and log the index of a specific city.
2. Read a string from the user, Find its length. Extract the word
“JavaScript” using substring() or slice(). Replace one word with
another word and log the new string. Write a
function isPalindrome(str) that checks if a given string is a palindrome
(reads the same backward).
3. Create an object student with properties: name (string), grade (number),
subjects (array), displayInfo() (method to log the student’s details)
Write a script to dynamically add a passed property to the student
object, with a value of true or false based on their grade. Create a loop
to log all keys and values of the student object.
4. Create a button in your HTML with the text “Click Me”. Add an event
listener to log “Button clicked!” to the console when the button is
clicked. Select an image and add a mouseover event listener to
change its border color. Add an event listener to the document that logs
the key pressed by the user.
5. Build a React application to track issues. Display a list of issues (use
static data). Each issue should have a title, description, and status (e.g.,
Open/Closed). Render the list using a functional component.
6. Create a component Counter with A state variable count initialized to 0.
Create Buttons to increment and decrement the count. Simulate
fetching initial data for the Counter component
using useEffect (functional component)
or componentDidMount (class component). Extend the Counter
component to Double the count value when a button is clicked. Reset
the count to 0 using another button.
7. Install Express (npm install express). Set up a basic server that responds
with “Hello, Express!” at the root endpoint (GET /). Create a REST API.
1a) Write a script that Logs “Hello, World!” to the console. Create a script that
calculates the sum of two numbers and displays the result in an alert box.
1b) Create an array of 5 cities and perform the following operations: Log the
total number of cities. Add a new city at the end. Remove the first city. Find and
log the index of a specific city.
1. Download Node.js
Go to the Node.js official website.
Download the LTS version (Long Term Support) which is more stable for
most use cases.
Install it by following the installation instructions specific to your operating
system (Windows, macOS, or Linux).
2. Verify Installation
After installing Node.js, open a terminal or command prompt and check the installed
version by running:
>node -v
Why Visual Studio Code? VS Code is a free, open-source code editor that
provides powerful features like IntelliSense, debugging support, Git integration, and
extensions specifically designed for JavaScript and Node.js development.
Download VS Code
Go to the Visual Studio Code official website.
Download the version for your operating system.
Install VS Code
Follow the installation instructions for your operating system.
Verify Installation
After installation, open VS Code and check if it’s working. If successful, you should
see the VS Code welcome screen.
1a) Write a script that Logs “Hello, World!” to the console. Create a script that
calculates the sum of two numbers and displays the result in an alert box.
console.log("Hello,World!");
calculateSum(5,7);
Open the vscode integrated terminal through the menu by selecting and type
the below command to run the program.
OUTPUT:
Hello, World!
Thesumis:12
Or
1a.html
<!DOCTYPE html>
<html>
<head>
<title>Welcome page</title>
</head>
<body>
<h1>Hello,World!</h1>
</body>
</html>
sum.html
<!DOCTYPE html>
<html>
<head>
<title>Console Input Sum</title>
</head>
<body>
<h1>Open the Console and Follow the Instructions</h1>
<script src="1a.js"></script>
</body>
</html>
1a.js
OUTPUT
1b) Create an array of 5 cities and perform the following operations: Log the total
number of cities. Add a new city at the end. Remove the first city. Find and log the
index of a specific city.
cities.push("San Francisco");
console.log("Cities after adding anew one:" +cities);
cities.shift();
console.log("Cities after removingthe first one: " + cities);
OUTPUT:
Totalnumber ofcities: 5
Cities after addinganewone:NewYork,Los Angeles,Chicago,Miami,Houston,SanFrancisco
Cities after removingthefirst one:LosAngeles,Chicago,Miami,Houston,SanFrancisco
Indexof Miami: 2
Or
1bb.js
// Create an arrayof 5 cities
let cities = ["New York","London","Paris", "Tokyo","Sydney"];
1b.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>City ArrayOperations</title>
output
Program 2
2. Read a string from the user, Find its length. Extract the word “JavaScript”
using substring() or slice(). Replace one word with another word and log the
new string. Write a function isPalindrome(str) that checks if a given string is a
palindrome (reads the same backward).
// Import the readline module to handle user input from the console
const readline = require('readline');
Open the vscode integrated terminal through the menu by selecting and type
the below command to run the program.
node index2.js
OUTPUT:
********************************output 1********************************
********************************output 2********************************
Program3
3. Create an object student with properties: name (string), grade (number), subjects
(array), displayInfo() (method to log the student’s details) Write a script to
dynamically add a passed property to the student object, with a value of true or
false based on their grade. Create a loop to log all keys and values of the student
object.
let student = {
name: "John Doe",
grade:85,
subjects:["Math","Science", "English"],
displayInfo: function() {
console.log(`Name: ${this.name}`);
console.log(`Grade:${this.grade}`);
console.log(`Subjects: ${this.subjects.join(',')}`);
}
};
Open the vscode integrated terminal through the menu by selecting and type
the below command to run the program.
node index3.js
OUTPUT:
Program4
4. Create a button in your HTML with the text “Click Me”. Add an event listener
to log “Button clicked!” to the console when the button is clicked. Select an
image and add a mouseover event listener to change its border color. Add an
event listener to the document that logs the key pressed by the user.
Open index.html file in vscode and copy the below code paste it into that file, save it.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Event Listeners Example</title>
<style>
img{
width:200px;
height: 140px;
border: 5px solid black;
margin-top:10px;
}
button {
padding: 5px 10px;
background: #000;
color: #fff;
border-radius:5px;
cursor: pointer;
}
</style>
</head>
<body>
<script>
const button = document.getElementById('myButton');
button.addEventListener('click',function () {
console.log('Button clicked!');
});
</html>
OUTPUT: