0% found this document useful (0 votes)
7 views2 pages

FSD File 120

The document describes two programming exercises. The first aims to create a "Hello World" program using an ES6 arrow function in React. The solution defines two functions, one using the function keyword and one using the arrow syntax, to output "Hello World". The second exercise aims to implement a "Hello World" program in Node.js. The solution creates an HTTP server that listens on port 8080 and responds to requests with the text "Hello, World!".

Uploaded by

legat52160
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

FSD File 120

The document describes two programming exercises. The first aims to create a "Hello World" program using an ES6 arrow function in React. The solution defines two functions, one using the function keyword and one using the arrow syntax, to output "Hello World". The second exercise aims to implement a "Hello World" program in Node.js. The solution creates an HTTP server that listens on port 8080 and responds to requests with the text "Hello, World!".

Uploaded by

legat52160
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Enrollment No.

: 202103103510120

Practical 1
Aim: Create a “Hello World” Program using the ES6 arrow function in React.

Solution :
<!DOCTYPE html>
<html lang="en">

<body>
<h1>Arrow Function</h1>
<p id="arrow"></p>
<p id="function"></p>

<script>
world = function()
{
return "Hello World"
}
document.getElementById("function").innerHTML = world();
hello = () => {
return "Hello World"
}
document.getElementById("arrow").innerHTML = hello();
</script>

</body>
</html>

Output :

CGPIT/AIDS/SEM-6/Full Stack Development 1


Enrollment No.: 202103103510120

Practical 3
Aim: Implement “Hello World” Program in node.js.

Solution :
const http = require('http');

const PORT = 8080;


const HOST = '192.168.198.30';

const server = http.createServer((req, res) => {


res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello, World!\n');
});

server.listen(PORT, HOST, () => {


console.log(`Congratuations Server running at\n http://${HOST}:${PORT}/`);
});

Output :

CGPIT/AIDS/SEM-6/Full Stack Development 2

You might also like