[Go to site: main page, start]

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

Java Script Assignment - Final Document

The document outlines a JavaScript assignment divided into three parts: practice tasks, assessment questions, and mini projects. Part A includes exercises on variables, arrays, conditional logic, loops, and functions. Part B consists of assessment tasks like counting vowels, reversing arrays, and checking for palindromes, while Part C offers mini project options such as a user list application and a quiz application.

Uploaded by

anshjadav2004
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)
7 views3 pages

Java Script Assignment - Final Document

The document outlines a JavaScript assignment divided into three parts: practice tasks, assessment questions, and mini projects. Part A includes exercises on variables, arrays, conditional logic, loops, and functions. Part B consists of assessment tasks like counting vowels, reversing arrays, and checking for palindromes, while Part C offers mini project options such as a user list application and a quiz application.

Uploaded by

anshjadav2004
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

JavaScript Assignment

Part A: Practice Tasks

1. Variables & Data Types

• Declare variables for the following:


• Name
• Birth year
• Learning status (boolean)
• Favorite programming languages
• Profile details (object)
• Log each value along with its data type using typeof .

2. Array & Object Operations

Create an array named products containing objects with the following properties: - id - name -
price - inStock

Perform the following operations: - Add a new product to the array - Remove an existing product from
the array - Update the price of a product - Print all product names - Filter and display only the products
that are in stock

3. Conditional Logic

• Write a program to check whether a given number is:


• Positive
• Negative
• Zero

4. Loops

Using loops: - Print numbers from 1 to 20 - Print all even numbers between 1 and 20 - Print numbers
from 10 to 1 in reverse order

5. Functions

Create functions for the following: - Convert temperature from Celsius to Fahrenheit - Check whether a
number is even or odd - Find and return the largest number among two numbers

1
Part B: Assessment (Attempt ALL Questions)

1. Count Vowels in a String

Write a function that counts the number of vowels in a given string.

Input / Output Examples: - Input: "javascript" → Output: 3 - Input: "education" → Output:


5

2. Reverse an Array

Reverse an array without using the built-in reverse() method.

Input / Output Examples: - Input: [1, 2, 3, 4] → Output: [4, 3, 2, 1] - Input: [10, 20,
30] → Output: [30, 20, 10]

3. Second Largest Number

Find the second largest number in a given array of numbers.

Input / Output Examples: - Input: [10, 40, 30, 20] → Output: 30 - Input: [5, 15, 25, 10]
→ Output: 15

4. Remove Duplicate Elements

Remove duplicate elements from a given array and return a new array with unique values.

Input / Output Examples: - Input: [1, 2, 2, 3, 4, 4] → Output: [1, 2, 3, 4] - Input:


["a", "b", "a", "c"] → Output: ["a", "b", "c"]

5. Palindrome Check

Write a function to check whether a given string is a palindrome.

Input / Output Examples: - Input: "madam" → Output: true - Input: "hello" → Output: false

6. Longest Substring Without Repeating Characters

Write a function that returns the length of the longest substring without repeating characters.

Input / Output Examples: - Input: "pwwkew" → Output: 3 - Input: "dvdf" → Output: 3 - Input:
"abcdef" → Output: 6

2
7. Merge Two Sorted Arrays

Merge two sorted arrays into a single sorted array without using the built-in sort() method.

Input / Output Examples: - Input: [1,4,7] , [2,3,6] → Output: [1,2,3,4,6,7] - Input:


[-5,0,3] , [-2,1,4] → Output: [-5,-2,0,1,3,4]

8. Longest Common Prefix

Find the longest common prefix among an array of strings.

Input / Output Examples: - Input: ["interview", "internet", "internal"] → Output:


"inte" - Input: ["apple", "banana", "cherry"] → Output: ""

Part C: Mini Projects (Choose Any ONE)

1. User List Application

• Add user names


• Display the list of users
• Delete a user on click

2. Todo Application

• Add new tasks


• Mark tasks as completed
• Delete tasks from the list

3. Quiz Application

• Create 10 multiple-choice questions


• Add a timer for each question
• Display the final score at the end

Submission Guidelines
• Submit JavaScript source code
• Attach screenshots of output
• Follow proper variable and function naming conventions
• Ensure code is readable and well-commented

Happy Coding 🚀

You might also like