0% found this document useful (0 votes)
1 views1 page

Day-5 Java Script Overview

The document explains type coercion in JavaScript, illustrating it with an example of adding a number and a string. It outlines a practical exercise involving the creation of a user-friendly profile form using HTML, CSS, and JavaScript, detailing the requirements for each technology. Additionally, it lists practical assignments for JavaScript programming, including checking number properties and developing a simple calculator.

Uploaded by

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

Day-5 Java Script Overview

The document explains type coercion in JavaScript, illustrating it with an example of adding a number and a string. It outlines a practical exercise involving the creation of a user-friendly profile form using HTML, CSS, and JavaScript, detailing the requirements for each technology. Additionally, it lists practical assignments for JavaScript programming, including checking number properties and developing a simple calculator.

Uploaded by

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

Type Coercion in JavaScript:

Type coercion is the automatic or implicit conversion of values from one data type
to another(such as string to number) by JavaScript.
Ex:
let x=5+"5"; //"55"
Practical Exercise:
Experiment with type coercion by performing operations between different data
types.(eg: number+ string, boolean+number) and observe the result.

Scenario
Imagine you are developing a user-friendly interface for a social networking site.
Users need a way to fill out their profile information, and once submitted, the
page dynamically displays their details in a well-designed card format. You will
use:

>HTML to create the form structure.


>CSS to style the form and display the user's information attractively.
>JavaScript to handle the form submission, validate inputs, and dynamically display
the user's information.

Requirements
HTML:
Create a form with fields for:
Name (text input)
Age (number input)
Favorite Hobby (dropdown menu)
Preferences (checkboxes for options like "Receive Newsletters" and "Enable
Notifications")
A submit button.
Add a section to display the submitted user profile dynamically.

CSS:
Style the form with a modern look.
Add a styled "User Profile Card" where the submitted data will be displayed.

JavaScript:
Handle form submission using an event listener.
Validate inputs (e.g., check if the name is not empty and age is a valid number).
Dynamically create and display a "User Profile Card" with the input data.

Practical Assignments and Exercises:


1. Create a script that checks if a number is positive, negative or zero.
2. Write a program to check if a number is even or odd using the ternary operator.
3. Create a program to display the name of the month based on the number(1-12).
4. Create a grading system where:
>Marks>=90:"A"
>Marks>=75: "B"
>Marks>=50:"C"
>Marks<50:"Fail"
5. Scenario: Develop a 'Simple Calculator" program that takes two numbers and an
operator(+,-,*,/) as input and displays the reuslt using a switch statement
Example Input:
num1=10, num2=5, operator="+"
output: Result:15

You might also like