Write a function getPrime(n) that returns the nth prime number.
function getPrime(n) {
// Your code here
}
Write a function extractDomain that returns the hostname within a well-formed complete URL e.g. extractDomain("http://www.google.com/search?q=jquery") should return http://www.google.com and extractDomain("http://localhost:3000/hello/world.html") should return localhost.
Hint: The domain name is the string between the first instance of "://", and the next instance of either ":" or "/"
function extractDomain(url) {
// Your code here.
}
Suppose I have an person object that represents a person that has properties firstName and lastName, which are both strings. Write a function greet(person), that returns the string “Hello “, followed by the person’s full name. For instance, greet({"firstName": "John", "lastName": "Smith"}) should return "Hello John Smith".
function greet(person) {
// Your code here.
}