React Internship Report
React Internship Report
1|Page
➔ We had also discussed about the most commonly used tags in html
for web development and that tags are as follows:
1. Tags used in <head>…</head>
a. <title>…</title>
b. <style>…</style>
c. <script>…</script>
d. <link>…</link>
2. Heading tags
a. <h1>…</h1>
b. <h2>…</h2>
c. <h3>…</h3>
d. <h4>…</h4>
e. <h5>…</h5>
f. <h6>…</h6>
3. Paragraph Tag → <p>...</p>
4. Preformatted Tag → <pre>…</pre>
5. Blockquote Tag → <blockquote>…</blockquote>
6. Division Tag → <div>…</div>
Etc…
2|Page
➢ Day 2
Basic introduction to CSS
Today we had discussed about CSS, it’s types, selectors in CSS
and the basic properties of CSS
Introduction to CSS
▪ C → Cascading
▪ S → Style
▪ S → Sheets
→CSS is basically used to style and layout the webpages and it can be
used by three ways:
1. Inline CSS
2. Internal CSS
3. External CSS
1.Inline CSS: Inline CSS is used by using style attribute of the HTML
elements.
2.Internal CSS: Internal CSS is used within the <style> element occurring
between the <head> element.
→It is mostly used only for one-page HTML website.
3.External CSS: External CSS is used by using the <link> element to link the
External CSS file.
→The External CSS is generally used when you want to make changes on multiple
pages.
❖ CSS Selectors:
1. Id: Used for unique content
2. Class: Used for multiple element styling
3. Tag name: Used for same tag names
4. Universal: Used for every element of the page
5. Group: Used for two or more element’s styling
3|Page
➢ Day 3
Today we had discussed about some CSS Properties like margin,
padding, width, height and a task is given to us to perform.
• Code:
<html>
<head>
<title>Document</title>
<style>
.container{
width: 300px;
border: 5px;
border: 5px solid black;
border-radius: 30px;
}
img{
width: 300px;
4|Page
height: 200px;
border-radius: 25px 25px 0px 0px;
}
.content{
text-align: center;
margin: 10px;
}
h4{
text-align: center;
}
p{
text-align: left;
margin: 10px;
}
</style>
</head>
<body>
<center>
<div class="container">
<img src="IMG_20230721_123042.jpg" alt="image">
<div class="content">
<h3>Card Title</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Suscipit ex
accusantium sit nisi ab perspiciatis!</p>
<button>Go Somewhere</button>
</div>
</div>
</center>
</body>
</html>
5|Page
• Output:
6|Page
➢ Day 4
Today we had discussed about the float property of CSS and some
tasks are given to us to perform.
• Float Property:
The CSS float property controls the positioning and formatting of content
on the page.
→ Its most common use is to wrap text around images.
→ However, you can use the float property to wrap any inline elements around
a defined HTML element, including lists, paragraphs, divs, spans, tables,
iframes, and blockquotes.
➔ Task 1: Aim: Design two cards using HTML and CSS that are
side by side of each other and which contains an image and some content.
• Code:
<html lang="en">
<head>
<title>Document</title>
<style>
div{
width: 430px;
margin: 20px;
border-radius: 30px;
border: 5px solid black;
float: left;
}
img{
width: 430px;
height: 120px;
7|Page
border-radius: 25px 25px 0px 0px;
}
h3{
text-align: center;
margin:20px;
}
p{
margin: 20px;
}
</style>
</head>
<body>
<div>
<img src="IMG_20230721_123042.jpg" alt="image">
<h3>Card Title</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus
asperiores saepe facere nisi! Similique, deleniti?</p>
</div>
<div>
<img src="IMG_20230721_123042.jpg" alt="image">
<h3>Card Title</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus
asperiores saepe facere nisi! Similique, deleniti?</p>
</div>
</body>
</html>
8|Page
• Output:
9|Page
float:left;
margin:20px 50px;
}
img{
border-radius: 50%;
}
</style>
</head>
<body>
<div>
<ul>
<li class="logo"><img src="IMG_20230721_123042.jpg" alt="image"
width="40px" height="40px"></li>
<li>Home</li>
<li>About</li>
<li>Support</li>
<li>Login</li>
</ul>
</div>
</body>
</html>
• Output:
10 | P a g e
➢ Day 5
Today we had discussed about the position property of CSS and
some tasks are given to us to perform using the position property.
• Position Property:
The CSS position property defines the position of an element in a
document.
→This property works with the left, right, top, bottom and z-index
properties to determine the final position of an element on a page.
11 | P a g e
</body>
</html>
(File name: 5style.css)
*{
margin: 0;
padding: 0;
}
.main{
border: 2px solid black;
border-radius: 10px;
position: relative;
width: 250px;
height: 300px;
color: white;
margin: 40px;
}
.image{
position: absolute;
}
img{
border-radius: 10px;
width: 250px;
height: 300px;
}
.content{
position: absolute;
bottom: 20px;
left: 10px;
}
h3{
margin: 0px 0px 20px 0px;
}
12 | P a g e
• Output:
➢ Task 2: Aim: Create 3 cards with the circle image in the center of the
card and some paragraph and a title of a card and 3 cards should be
floating in the left.
• Code: (File name: task.html)
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="6style.css">
<title>Document</title>
</head>
<body>
<div>
<img src="IMG_20230721_123042.jpg" alt="image">
<h3>Lorem Ipsum</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Facere
tempore vel, soluta dolore ullam aperiam delectus provident vero perspiciatis
illo?</p>
13 | P a g e
</div>
<div>
<img src="IMG_20230721_123042.jpg" alt="image">
<h3>Lorem Ipsum</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Facere
tempore vel, soluta dolore ullam aperiam delectus provident vero perspiciatis
illo?</p>
</div>
<div>
<img src="IMG_20230721_123042.jpg" alt="image">
<h3>Lorem Ipsum</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Facere
tempore vel, soluta dolore ullam aperiam delectus provident vero perspiciatis
illo?</p>
</div>
</body>
</html>
(File name: 6style.css)
*{
margin: 0;
padding:0;
}
div{
width: 250px;
height: 250px;
border: 2px solid black;
border-radius: 10px;
margin-top: 100px;
margin-left: 52px;
float: left;
position: relative;
}
14 | P a g e
img{
position: absolute;
width: 100px;
height: 100px;
border-radius: 50%;
left: 80px;
top: -50px;
}
h3{
position: absolute;
top: 70px;
left: 65px;
}
p{
text-align: center;
position: absolute;
top: 100px;
}
• Output:
15 | P a g e
➢ Day 6
Today we have discussed about the hover property, display: flex
property and some tasks are given to use to perform.
• Flex Property:
The flex property is used to set the length of flexible items. The flex
property is much more responsive and mobile-friendly.
→It is easy to position child elements and the container.
• Hover Property:
The :hover selector is used to select elements when you mouse over them.
➢ Task 1: Aim: Create a navigation bar such that when you hover on
any item of navigation bar it will open a dropdown list and when you
hover on any list items it will also open a dropdown list on the left or
right side.
• Code: (File name: task.html)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<link rel="stylesheet" href="3style.css">
</head>
<body>
<div>
<ul>
<li class="logo"><img src="IMG_20230721_123042.jpg"
alt="image" width="40px" height="40px"></li>
<li>Home</li>
<li>About</li>
16 | P a g e
<li class="mainservice">Services
<div class="childservice">
<ul>
<li class="service1">Service1
<div class="childservice1">
<ul>
<li>service1-a</li>
<li>service1-b</li>
<li>service1-c</li>
</ul>
</div>
</li>
<li>Service2</li>
<li>Service3</li>
</ul>
</div>
</li>
<li>Login</li>
</ul>
</div>
</body>
</html>
(File name: 3style.css)
*{
margin:0px;
padding:0px;
}
div{
height: 60px;
background-color: black;
color: white;
}
17 | P a g e
ul{
list-style-type: none;
}
.logo{
margin: 5px 10px;
}
li{
float: left;
margin: 10px 50px;
}
img{
border-radius: 50%;
}
.childservice{
background-color: black;
color: white;
width: 60px;
text-align: center;
display: none;
clear: left;
height: 80px;
}
.childservice li{
margin: 5px 0px 0px 0px;
}
.mainservice:hover > .childservice{
display: block;
}
.service1{
position: relative;
}
.childservice1 li{
18 | P a g e
border-bottom: 1px solid black;
}
.childservice1{
height: auto;
background-color: white;
color: black;
display: none;
position: absolute;
top: 0;
left: 60px;
width: 70px;
border: 1px solid black;
}
.service1:hover > .childservice1{
display: block;
}
• Output:
20 | P a g e
.nav{
display: flex;
justify-content: space-between;
width: 30%;
}
• Output:
21 | P a g e
➢ Day 7
Today we have discussed about flex-direction and media query
concepts and a task is given to us to perform.
• Flex-direction:
Flex direction in CSS is a sub-property of the flexible box layout module.
→It establishes the main axis, thus defining the direction flex items are ordered of
placed ion the flex container.
• Media query:
Media queries allow you to apply CSS styles depending on a device’s
general type or other characteristics such as screen resolution or browser
viewport width.
22 | P a g e
<ul class="nav">
<li>Investor Relations</li>
<li>Add restaurant</li>
<li>Log in</li>
<li>Sign up</li>
</ul>
</div>
<div class="content">
<img src="zomato1.avif" alt="Image" height="60px"
width="300px">
<h1>Discover the best food & drinks in Ahmedabad</h1>
</div>
</div>
<div class="new">
<div class="cards">
<div class="card">
<img src="zomatohome.jpg" alt="image">
<div class="cardcontent">
<p class="title">Order Online</p>
<p class="subtitle">Stay home and order to your doortep</p>
</div>
</div>
<div class="card">
<img src="zomatohome.jpg" alt="image">
<div class="cardcontent">
<p class="title">Dining</p>
<p class="subtitle">View the city's favourite dining venues</p>
</div>
</div>
</div><br><br><br><br>
<div class="cards1">
<h1>Collections</h1>
23 | P a g e
<p>Explore curated lists of top restaurants, cafes, pubs, and bars in
Ahmedabad, based on trends</p><br><br>
<div class="dflex">
<div class="card1 c1">
<img src="zomatohome.jpg" alt="image">
<h3>7 Picturesque Cafes</h3>
<p>6 Places</p>
</div>
<div class="card1 c2">
<img src="zomatohome.jpg" alt="image">
<h3>Winners of Zomato Restaurant Awards</h3>
<p>8 Places</p>
</div>
<div class="card1 c3">
<img src="zomatohome.jpg" alt="image">
<h3>8 Newly Opened Restaurants</h3>
<p>8 Places</p>
</div>
<div class="card1 c4">
<img src="zomatohome.jpg" alt="image">
<h3>7 Great Buffets</h3>
<p>7 Places</p>
</div>
</div>
</div>
</div>
</body>
</html>
(File name: style.css)
*{
margin: 0;
padding: 0;
24 | P a g e
font-family: "Okra", Helvetica, sans-serif;
font-weight: normal;
}
.main{
background-image: url("zomatohome.avif");
background-position: center;
color: white;
height: 419px;
}
ul{
list-style-type: none;
}
.getapp{
font-size: 14px;
padding: 0px 0px 10px;
}
.navbar{
display: flex;
justify-content: space-between;
position: relative;
margin: 0px auto;
margin: 0px 110px 0px 110px;
padding: 17px 0;
}
.nav{
display: flex;
width: 480px;
justify-content: space-between;
font-size: 18px;
padding: 8px;
}
.content, .content h1{
25 | P a g e
margin: 30px;
text-align: center;
}
.cards{
display: flex;
justify-content: space-evenly;
margin-top: 40px;
}
.card{
border: 1px solid black;
border-radius: 10px;
overflow: hidden;
width: 540px;
height: 240px;
}
.card img{
width: 100%;
height: 160px;
}
.cardcontent{
padding: 10px 20px 16px;
}
.title{
font-size: 20px;
}
.subtitle{
font-size: 16px;
font-weight: lighter;
}
.title, .subtitle{
padding: 5px;
}
26 | P a g e
.cards1{
display: flex;
flex-direction: column;
}
.cards1 h1{
font-size: 36px;
}
.cards1 p{
font-size: 18px;
margin-top: 10px;
font-weight: lighter;
}
.new{
margin: 0px 80px 0px 80px;
}
.card1{
border: 2px solid black;
border-radius: 10px;
width: 267px;
height: 320px;
position: relative;
color: white;
overflow: hidden;
float: left;
margin-right: 9px;
}
.card1 img{
width: 100%;
height: 100%;
position: absolute;
}
.card1 h3 , .card1 p{
27 | P a g e
position: absolute;
bottom: 10px;
padding: 0px 16px;
}
.card1 p{
font-size: 14px;
}
.card1 h3{
font-size: 18px;
margin: 0px 0px 20px 0px;
font-weight: normal;
}
/*Media Query*/
@media only screen and (max-width:768px){
.cards{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.card{
margin: 10px 0px;
width: 90%;
}
.card img{
width: 100%;
}
.navbar, .nav{
display: flex;
flex-direction: column;
}
.main{
28 | P a g e
width: 100%;
}
.getapp{
display: none;
}
.c3{
clear: left;
}
.c3, .c4{
margin: 10px 9px 0px 0px;
}
}
• Output: (Responsive)
29 | P a g e
30 | P a g e
➢ Day 8
Today we have discussed about Bootstrap basics and a task is
given to us to perform.
• What is Bootstrap?
→Bootstrap is the most popular CSS Framework for developing responsive and
mobile-first websites.
31 | P a g e
xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD6
9Npy4HI+N" crossorigin="anonymous">
<script
src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
integrity="sha384-
DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+O
rCXaRkfj" crossorigin="anonymous"></script>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.m
in.js" integrity="sha384-
Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9d
O5Vg3Q9ct" crossorigin="anonymous"></script>
</head>
<body>
<div id="carouselExampleIndicators" class="carousel slide" data-
ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0"
class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<div class="row bg-dark" style="height:400px;">
<img src="https://picsum.photos/200/300" class="d-block w-50
rounded-circle col-6 h-100" alt="IMG_20210815_090736.jpg">
<div class="col-6 d-flex flex-column justify-content-center align-
middle h-100">
<p class="text-light" style="font-size: 25px;">Lorem ipsum
dolor sit amet consectetur adipisicing elit. Consequuntur deserunt modi
32 | P a g e
doloremque necessitatibus similique enim molestias libero unde qui, veritatis
illo ab. Eveniet, alias totam!</p>
</div>
</div>
</div>
<div class="carousel-item">
<div class="row bg-dark" style="height:400px;">
<img src="https://picsum.photos/200" class="d-block w-50
rounded-circle col-6 h-100" alt="IMG_20210815_090736.jpg">
<div class="col-6 d-flex flex-column justify-content-center align-
middle h-100">
<p class="text-light" style="font-size: 25px;">Lorem ipsum
dolor sit amet consectetur adipisicing elit. Consequuntur deserunt modi
doloremque necessitatibus similique enim molestias libero unde qui, veritatis
illo ab. Eveniet, alias totam!</p>
</div>
</div>
</div>
<div class="carousel-item">
<div class="row bg-dark" style="height:400px;">
<img src="https://picsum.photos/id/237/200/300" class="d-block
w-50 rounded-circle col-6 h-100" alt="IMG_20210815_090736.jpg">
<div class="col-6 d-flex flex-column justify-content-center align-
middle h-100">
<p class="text-light" style="font-size: 25px;">Lorem ipsum
dolor sit amet consectetur adipisicing elit. Consequuntur deserunt modi
doloremque necessitatibus similique enim molestias libero unde qui, veritatis
illo ab. Eveniet, alias totam!</p>
</div>
</div>
</div>
</div>
33 | P a g e
<button class="carousel-control-prev" type="button" data-
target="#carouselExampleIndicators" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-
target="#carouselExampleIndicators" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</button>
</div>
</body>
</html>
• Output:
34 | P a g e
➢ Day 9
Today we have discussed about grid system and difference
between container and container-fluid concepts and a task is given to us
to perform.
• Container: Containers are the most basic layout element in Bootstrap and
are required when using default grid system.
→ Containers are used to contain, pad, and (sometimes) center the content
within them. While containers can be nested, most layouts do not require a
nested container.
→Bootstrap comes with three different containers:
→The table below illustrates how each container’s max-width compares to the
original .container and .container-fluid across each breakpoint.
35 | P a g e
➢ Task: Aim: Create a clone of a Zomato.com using
bootstrap and the website has to be responsive.
zomatobootstrap.zip
36 | P a g e
➢ Day 10
Today we have discussed about basics of JavaScript and some core
JS concepts like variable, print statements (console.log()), etc.
• What is JavaScript?
Java-Script is a high-level programming language means it is an English like
language which is easy to understand by the humans and it is interpreted language.
• Features of JavaScript:
1) High-level language: JavaScript is a high-level programming language,
meaning it provides a more abstract and human-readable syntax, making it
easier for developers to write and understand code.
2) Interpreted language: JavaScript is an interpreted language, which
means that it doesn't require a separate compilation step. Instead, the code
is executed directly by the web browser or a JavaScript engine.
3) Dynamic typing: JavaScript uses dynamic typing, allowing variables to
hold values of any data type. The data type of a variable can change at
runtime.
4) Object-oriented programming (OOP) support: JavaScript supports
object-oriented programming concepts like classes, objects, inheritance,
and polymorphism.
5) Functions as first-class citizens: Functions in JavaScript are treated as
first-class citizens, meaning they can be assigned to variables, passed as
arguments to other functions, and returned from functions.
6) Event-driven programming: JavaScript is well-suited for event-driven
programming, allowing developers to respond to user interactions (e.g.,
clicks, key presses) and other events (e.g., timers, HTTP requests).
7) Asynchronous programming: JavaScript supports asynchronous
programming through mechanisms like callbacks, promises, and
37 | P a g e
async/await, which are crucial for handling time-consuming operations
without blocking the main thread.
8) Cross-platform compatibility: JavaScript is supported by all major web
browsers, making it a cross-platform language for web development.
9) DOM manipulation: JavaScript can interact with the Document Object
Model (DOM), allowing developers to dynamically modify the content
and structure of web pages, enabling interactive and responsive user
interfaces.
10) Libraries and frameworks: JavaScript has an extensive ecosystem of
libraries and frameworks, such as React, Angular, and Vue.js, which
simplify and enhance web development tasks.
• Applications of JavaScript:
1) Web Development: JavaScript is primarily used for front-end web
development to create dynamic and interactive user interfaces. It allows
developers to manipulate the DOM, handle user events, and create
responsive web pages.
2) Web Applications: JavaScript is the backbone of many modern web
applications, enabling functionalities like form validation, user
authentication, and real-time updates.
3) Single-Page Applications (SPAs): SPAs are web applications that load a
single HTML page and dynamically update the content as users interact
with the application. JavaScript frameworks and libraries like React,
Angular, and Vue.js are widely used for building SPAs.
4) Browser Extensions and Add-ons: JavaScript is commonly used to
develop browser extensions and add-ons, which enhance the functionality
of web browsers.
5) Mobile App Development: With frameworks like React Native and Ionic,
JavaScript can be used to build cross-platform mobile applications for iOS
and Android devices.
38 | P a g e
6) Game Development: JavaScript can be utilized to create simple browser-
based games and interactive animations using HTML5 canvas and other
game development libraries like Phaser and Three.js.
7) Server-side Development: Node.js is a popular runtime environment that
allows developers to use JavaScript for server-side programming. It
enables building scalable, real-time, and event-driven server applications.
8) Desktop Applications: Technologies like Electron leverage JavaScript to
build desktop applications using web technologies, which can run on
various platforms like Windows, macOS, and Linux.
9) Data Visualization: JavaScript libraries like D3.js enable developers to
create interactive and visually appealing data visualizations and charts for
displaying complex data sets.
10) Internet of Things (IoT): JavaScript is used in IoT development,
particularly in the context of IoT platforms and applications that require
client-side interactions and real-time data processing.
11)
• What is Variable? and how to define a variable?
A variable is a named container used to store the data.
→To define a variable the ‘var’ keyword used in JavaScript.
▪ Syntax:
var variable_name = value;
▪ Example:
var name = “abc”;
• Console.log() statement in JavaScript:
▪ Syntax:
console.log(“String”, variable);
▪ Example:
var a = 5;
console.log(“value of a = ”, a);
39 | P a g e
➢ Day 11
Today we have discussed about conditional statements and loops
in JavaScript and some tasks are given to us.
• Conditional Statements:
1) If statement
2) If…else statement
3) If…else if…else statement
4) Switch case
• Looping Statements:
1) For loop
2) While loop
3) Do…while loop
➢ Task 1: Aim: Print the odd and even numbers to the given number
using for and while loop.
• Code:
<html>
<script>
var a = prompt();
var i=1;
while(i<=a){
if(i%2==0){
console.log("Even numbers: ", i);
}
i++;
}
for(var j=1; j<=a; j++){
if(j%2!=0){
console.log("Odd numbers: ", j);
}
40 | P a g e
}
</script>
</html>
• Output:
➢ Task 2: Aim: Take percentage from the user and convert it to the grade.
• Code:
<html>
<script>
var per = prompt();
if(per>=80){
console.log("A grade");
}
else if(per>=75 && per<80){
console.log("B grade");
}
else if(per>=55 && per<75){
console.log("C grade");
}
else if(per>=35 && per<55){
console.log("D grade");
41 | P a g e
}
else if(per<35){
console.log("F grade");
}
else{
console.log("invalid input");
}
</script>
</html>
• Output:
42 | P a g e
}
console.log("Using for");
for(var i=10; i>=1; i--){
console.log(i);
}
</script>
</html>
• Output:
➢ Task 4: Aim: Take a number input from the user and create a table of
that number.
• Code:
<html>
<script>
var a = prompt();
for(var i = 1; i<=10; i++){
console.log(a, "X", i, "=", (a*i));
}
</script>
43 | P a g e
</html>
• Output:
44 | P a g e
➢ Day 12
Today we have discussed about the string and array functions and
some tasks are given to use to perform.
• String Functions:
1) Length → to find the length of string.
2) Slice() → slice out the string from one position to another position.
3) Substring() → slice out the string from one position to another
position.
4) Substr() → slice out the string from one position to the given length.
5) Replace() → replace the first occurring character with the other string
or character passed in the parameter.
6) Replaceall() → replace all the characters occurring in the string with
the string or character passed in the parameter.
7) toUpperCase() → convert the String in to the upper case.
8) toLowerCase() →convert the string in to the lower case.
9) concat() → concatenate two strings.
• Array Functions:
1) Length → to find out the length of array.
2) toString() → to convert the array to the string.
3) pop() → to delete the element from the end of the array.
4) push() → to add the element at the end of the array.
5) shift() → removes the first array element and shifts all other elements
to a lower index.
6) unshift() → adds a new element to an array at the beginning and
unshifts older elements.
45 | P a g e
• Code:
<html>
<script>
var a = prompt();
var len = a.length-1;
var temp = "";
for(var i=len; i>=0; i--){
temp = temp.concat(a[i]);
}
document.write(temp);
</string>
</html>
• Output:
46 | P a g e
for(var i = 0; i<=len;i++){
if(a[i]=='a' || a[i]=='e' || a[i]=='i' || a[i]=='o' || a[i]=='u'){
count = count+1;
}
}
document.write("Number of vowels ouccuring in the string = ",count);
</string>
</html>
• Output:
47 | P a g e
if(i%2==0){
a = a.replace(a[i],"*");
}
}
document.write(a);
</string>
</html>
• Output:
➢ Task 4: Aim: Print the sum of all the numbers in the array.
• Code:
<html>
<script>
var arr = [10,20,30,40];
var count = 0;
for (let i = 0; i < arr.length; i++) {
count = count+arr[i];
}
document.write(count);
48 | P a g e
</string>
</html>
• Output:
49 | P a g e
➢ Day 13
Today we have discussed about some queries and some tasks are
given us to perform.
➢ Task 1: Aim: Take a sentence input from the user and reverse
the sentence.
• Code:
<html>
<script>
var a = prompt();
var b = a.split(" ");
for(let i = b.length-1; i>=0; i--){
document.write(b[i], " ");
}
</script>
</html>
• Output:
50 | P a g e
➢ Task 2: Aim: Check if the combination of words in array are
similar for two arrays or not.
• Code:
<html>
<script>
var a1 = ["ab","cdef"];
var a2 = ["abc","def"];
var temp1 = a1.toString();
var temp2 = a2.toString();
temp1 = temp1.replace(",", "");
temp2 = temp2.replace(",", "");
if (temp1==temp2) {
document.write("True");
}
else{
document.write("False");
}
</script>
</html>
• Output:
➢ Task 3: Aim: Find out the sentence that have most number of
word from the array.
• Code:
<html>
<script>
51 | P a g e
var a = ["Lorem ipsum dolor sit.", "lorem", "Lorem, ipsum.",
"Lorem ipsum dolor sit amet."];
var arr = [];
var len = "";
for (let i = 0; i < a.length; i++) {
arr.push(a[i].split(" "));
if(arr[i].length>len.length){
len = arr[i];
}
}
var temp = len.toString();
document.write("LONGEST SENTENCE IN THE ARRAY = ",
temp.replaceAll(","," "));
</script>
</html>
• Output:
52 | P a g e
➢ Day 14
Today we have discussed about functions in java script and some
tasks are given to us to perform.
• Functions:
In JavaScript, a function is a block of reusable code that performs a
specific task or a set of tasks.
→ Functions are fundamental building blocks of JavaScript
programming and allow you to encapsulate logic, promote reusability,
and organize your code into manageable units.
➢ Task 1: Aim: combine two strings in third string such that first
string’s first character than second string’s first character than first
string’s second character and so on.
• Code:
<html>
<script>
var str1 = "abc";
var str2 = "pqrstr";
var str3 = "";
for (let i = 0; i < str1.length; i++) {
str3+=str1[i]+str2[i];
}
for (let j = str1.length; j < str2.length; j++) {
str3+=str2[j];
}
console.log(str3);
</script>
</html>
53 | P a g e
• Output:
54 | P a g e
➢ Task 3: Aim: Create a simple numeric calculator using function
which takes 3 arguments 2 numbers and 1 operator.
• Code:
<html>
<script>
function calculator(n1, n2, sign){
switch(sign){
case '+':
console.log(n1 + n2);
break;
case '-':
console.log(n1 - n2);
break;
case '*':
console.log(n1 * n2);
break;
case '/':
console.log(n1 / n2);
break;
case '%':
console.log(n1 % n2);
break;
default:
console.log("invalid choice");
}
}
calculator(10, 20, '+');
</script>
</html>
55 | P a g e
• Output:
56 | P a g e
➢ Day 15
Today we have discussed about ES6 concepts in java script and
some tasks are given to us to perform.
57 | P a g e
3) Not Hoisted: const variables are not hoisted to the top of their scope like
var variables are. They are in the Temporal Dead Zone until the line of
code where they are defined is reached:
4) Immutable Reference: When using const with objects or arrays, the
reference to the object or array is constant, but the contents of the object
or array can still be modified:
→Spread Operator:
The spread operator is used to spread elements from an iterable (like an
array or a string) into individual elements. It can be used in various situations to
make copies of arrays, concatenate arrays, or to pass elements as arguments to
functions.
→Example:
const array1 = [1, 2, 3];
const array2 = [4, 5, 6];
58 | P a g e
const combinedArray = [...array1, ...array2]; // Combining arrays
const copyOfArray1 = [...array1]; // Creating a copy of an array
59 | P a g e
});
});
60 | P a g e
return ((item[0]=="a" || item[0]=="e" ||item[0]=="o"
||item[0]=="i" ||item[0]=="u")&&(item[item.length-1]=="a" ||
item[item.length-1]=="e" ||item[item.length-1]=="o"
||item[item.length-1]=="i" ||item[item.length-1]=="u"));
}).length;
console.log(count);
</script>
</html>
• Output:
61 | P a g e
}
}
for (const i of temp2) {
if(i=="a" || i=="e" || i=="i" || i=="o" || i=="u"){
count2++;
}
}
if(count1==count2){
console.log("true");
}
else{
console.log("false")
}
</script>
</html>
• Output:
62 | P a g e
➢ Day 16
Today we understood what is React JS and what are the
features of it and how to setup the workspace for React JS.
• What is React JS?
ReactJS, commonly referred to as React, is an open-source
JavaScript library used for building user interfaces (UIs) and user
interface components. It was developed by Facebook and later
maintained by Facebook along with a community of developers
and companies. React allows developers to create reusable UI
components and manage the state of an application efficiently.
63 | P a g e
5) JSX: JSX (JavaScript XML) is a syntax extension for JavaScript used
in React. It allows developers to write UI components using a syntax
similar to HTML within JavaScript code, making it more intuitive to
describe UI elements and their structure.
6) One-Way Data Binding: Data flows in a one-way direction in React.
Changes in the state of a component trigger a re-rendering of the
component and its children, ensuring a predictable flow of data and
reducing the likelihood of unexpected side effects.
7) Component Lifecycle Methods: React components have lifecycle
methods that developers can hook into. These methods provide
control over the different phases of a component's existence, such as
when it's created, updated, or removed from the UI.
8) Component Reusability: React's component-based architecture
promotes reusability. Developers can create a library of components
that can be easily reused across different parts of an application or
even across multiple projects.
This will start the development server and open your React application in a
web browser. The development server automatically reloads the page
whenever you make changes to the code.
• Output:
65 | P a g e