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

Js&Ts

The document outlines various programming tasks in JavaScript and TypeScript, including creating classes, demonstrating promises, async/await, form validation, and array methods. It also covers object and array destructuring, user-defined exceptions, and the creation of HTML elements using JavaScript. Additionally, it includes TypeScript-specific tasks such as creating classes with static and non-static members, abstract classes, and interfaces.

Uploaded by

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

Js&Ts

The document outlines various programming tasks in JavaScript and TypeScript, including creating classes, demonstrating promises, async/await, form validation, and array methods. It also covers object and array destructuring, user-defined exceptions, and the creation of HTML elements using JavaScript. Additionally, it includes TypeScript-specific tasks such as creating classes with static and non-static members, abstract classes, and interfaces.

Uploaded by

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

Javascript

1. Create a class named Emp with following attribute name, id, salary & displayInfo
method provide access code for the same.

2. Demonstrate an example for Promise.

3. Demonstrate an example of Async and await.

4. Create an object called person with properties name, age, and gender. Access
and log the name property to the console.

5. Create an arrow function named square that takes a number as a parameter


and returns the square of that number.

6. Implement an anonymous function assigned to the variable multiplyByTwo that take


number as a parameter and multiplies each element by 2.

7. Create a Form with Fields for Username, Age, and Password. Implement JavaScript
Validation to Ensure:
a. Username contains only alphanumeric characters.
b. Age is a number greater than 18.
c. Password should have a minimum length of 8 characters, including at least
one uppercase letter, one lowercase letter, and one digit..

8. Write JavaScript Code to Validate a Registration Form with Fields for First Name,
Last
Name, and Phone Number:
a. First Name and Last Name should contain only alphabetic characters.

9. Create a Form with Fields for Address, City, and email. Use JavaScript to Implement
Validation That Checks:
a. Address should not be empty.
b. City should only contain letters.
c. Email should contain a valid format.

10. Demonstrate an example for user defined exception.

11. Demonstrate an example for throw.

12. Provide an example of array destructuring and object destructuring in


JavaScript.

13. Demonstrate array method (map, filter, reduce)


a. Map to square each number.
b. Filter to extract even number.
c. Reduce to calculate the sum of all elements.
14. Demonstrate how to create a new <li> element, set its text content, and
append it to an existing <ul> element on a web page using JavaScript.

Typescript

1. Create a Class Manager with Attributes name, id, salary, department, and a Method
to Display Manager Information.

2. Create a Class with Static and Non-Static Members to Represent a Company.


Include Static Members for Company-Wide Policies and Non-Static Members for
Employee Data.

3. Show an Example of a Parameterized Constructor in a Department Class with


Attributes name, location, and numberOfEmployees.

4. Demonstrate an Abstract Class AbstractEmployee with Abstract Methods for


CalculateBonus and Displaying Info, and Extend It with Concrete Classes
FullTimeEmployee and PartTimeEmployee.

5. Create an Interface for Employee with Methods calculateSalary and


displayDetails, and Implement It in Classes FullTimeEmployee and
PartTimeEmployee.

6. Demonstrate example for generic in function.

You might also like