Skip to content

armeagle777/homework-error-regex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Errors-And-Regexp

This branch is made for hometasks

Tasks

1.ReverseString function

➡️ Task: Complete the reverseString function, it has one parameter s. You must perform the following actions:

  • Try to reverse string s using the split, reverse, and join methods.
  • If an exception is thrown, catch it and print the contents of the exception's message on a new line.
  • Print s on new line. If no exception was thrown, then this should be the reversed string, if an exception was thrown, this should be the original string.

➡️ Solution

2.isPositive function

➡️ Complete the isPositive function below. It has one integer parameter a . If the value of a is positive, it must return the string YES. Otherwise, it must throw an Error according to the following rules:

  • If a is 0, throw an Error with message = Zero Error.
  • If a is negative, throw an Error with message = Negative Error.

➡️ Solution

3.Convert the code using try...catch.

➡️ Convert the code using try...catch.

➡️ Solution

4.Teacher's gradeLabs function

➡️ Trying teacher's function for all students, given in an array

➡️ Solution

5.Regexp for exactly 4 or 6 digits

➡️ Create a RegExp myRegExp to test if a string is a valid pin or not.

➡️ Solution

Built With

  • Vanilla JavaScript

Author

Tigran Yeranyan

Contributions, issues, and feature requests are welcome!

Give a ⭐️⭐️⭐️⭐️⭐️ if you like this project!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published