close
Skip to content

dnestoff/Javascript-Algorithms

Repository files navigation

Javascript Algorithm Work

This repo has a number of algorithmic challenges designed to show my ability to solve problems in Javascript.

Jasmine Tests

Tests have been written to provide feedback on whether our code is behaving as desired. The tests use the Jasmine testing library and are run in the browser.

Algorithmic Challenges

Rectangle Functions

Four functions calculating various measures of rectangles.

To run the tests, open RectangleSpecRunner.js in the browser.

A Valid Triangle

A function taking as its input three non-negative numbers which returns true if the three side lengths could form a triangle and false otherwise.

To run the tests, open TriangleSpecRunner.js in the browser.

Totals and Averages

Functions that calculate values from an array of numbers.

To run the tests, open AverageSpecRunner.js in the browser.

Pad an Array

A function accepting between two and three arguments: an array, a non-negative integer, and an optional value. The array represents the starting point for the padded array. The integer represents the minimum length of the returned array. The optional value represents the value to insert if the size of the input array needs to be increased. If the array's length is less than the minimum size, pad() returns a new array padded with the pad value up to the minimum size.

To run the tests, open PadSpecRunner.js in the browser.

Count Between

Write a function countBetween() which takes three arguments as input (an integer array, upper boundary, and lower boundary), and returns the number of integers in the array that are between the two bounds, including the bounds.

To run the tests, open CountBetweenSpecRunner.js in the browser.

Factorial

A function which takes a non-negative integer and calculates the factorial of that number.

To run the tests, open FactorialSpecRunner.js in the browser.

Longest String

A function taking an array of strings that returns the longest string in the array.

To run the tests, open LongestStringSpecRunner.js in the browser.

Guessing Game

A constructor function for creating custom guessing game objects. We'll initialize new guessing games by passing in an integer called answer. Instance methods include take an integer ('a guess') as input and output whether a guess is high or low. Also includes an instance method which produces a boolean value based on whether a game has been solved.

To run the tests, open GuessingGameSpecRunner.js in the browser.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors