We start with a few basic exercises to get you comfortable with writing, and debugging, short JavaScript programs.
- Implement the function
isPalindrome(x)which returns true if and only if x is a string that is a palindrome, that is, it reads the same forward an backwards: A man, a plan, a canal, Panama! Implement a function called
chechISBN(id)which takes as input a string (id) and returns true if and only if theidis a valid ISBN number. Please read wikipedia section which gives you the equation for verifying the check digit in an ISBN number.-
Implement a function called
isNPI(x)which takes as input a 10-digit numberxand returns true if that number is an NPI number. There procedure for checking if a number is an NPI number is described here, see the "Example of Check Digit Calculation" section. Note that the check bit is the last (10th) digit in the number. - Implement a function
createDeckwhich returns a JSON object that represents all the cards in a deck of cards. The object return should be an array with 52 object, each one of which should have asuitand avalueproperty. The suits are: hearts, diamonds, clubs, spades. The values are, Ace, 2, 43, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King.
No comments:
Post a Comment