Skip to content

DarkAsfu/javascript-problem-solving

Repository files navigation

JavaScript Programming Challenges

This repository contains JavaScript solutions to various programming challenges. Below, you'll find descriptions of each task along with their corresponding solutions.

Task 1: Reversed String

Description

Create a function that takes a string as input and returns the reversed version of the string without using the built-in reverse() method.

Example

Input: "hello world"
Output: "dlrow olleh"

Task 2: Sum of Positive Numbers

Description

Create a function that takes an array of numbers as input and returns the sum of all positive numbers in the array.

Example

Input: [2, -5, 10, -3, 7]
Output: 19

Task 3: Most Frequent Element in an Array

Description

Write a JavaScript program to find the most frequent element in an array and return it.

Example

Input: [3, 5, 2, 5, 3, 3, 1, 4, 5]
Output: 3

Task 4: Find Two Numbers Summing to a Target

Description

Create a function that takes a sorted array of numbers and a target value as input. The function should find two numbers in the array that add up to the target value. Return an array containing the indices of the two numbers.

Example

Input: ([1, 3, 6, 8, 11, 15], 9)
Output: [1, 2] (numbers at indices 1 and 2: 3 + 6 = 9)

Task 5: Simple JavaScript Calculator

Description

Implement a simple JavaScript calculator. The calculator should take two numbers and an operator (+, -, *, /) as input and return the result of the operation.

Task 6: Generate a Random Password

Description

Create a program that generates a random password of a specified length. The password should include a mix of uppercase letters, lowercase letters, numbers, and special characters.

Task 7: Roman Numeral to Integer

Description

Implement a function that converts a Roman numeral to an integer. The function should take a Roman numeral string (e.g., "IX" or "XXI") as input and return the corresponding integer value.

Task 8: Second Smallest Element in an Array

Description

Implement a JavaScript function to find the second smallest element in an array of numbers. The function should return the second smallest number.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors