Some assignments from The Telerik Academy on JS Fundamentals
1.Binary search
The assignment was to put the binary search to some use.
2.Convert number to it's English word
3 switch-cases was all that it needs.
3.Coordinate system
This scripts demonstrates the use of objects.
There is a function for making points and lines.There are two more functions,
one for calculating the distance between two points and the other is for checking if three lines can make a triangle.
4.Deep copy
Write a function that makes a deep copy of an object.The function should work for both primitive and reference types.
Two functions are made.One for printing objects and the other is for deep copy.
5.Find words in text
The assignment was to find how many times a given word is found in a text and also there has to be a case-sensitive
and a case-insensitive search.Also there must be function overloading or "fake overloading" since JS doesn't support
overloading and I did it using a switch case and the functions arguments length.
First I remove all dots and commas with "someText.replace(/\W+/g, ' '); " and then I make an array of all the
words in the text with "tempString.split(' ');".After that it's a simple comparing of strings.
Case 2 is the case-sensitive search and case 3 is the insensitive.
7.Neighbours
The assignment is: Write a function that checks if the element at given position in given array of integers is bigger
than its two neighbors (when such exist).
8.Quadratic equation
Nothing to explain.
9.Coloring table A simple function to color table lines with random colors.