Here is the task at hand:
Write a function called charAt which accepts a string and an index (number) and returns the character at that index.
The function should return an empty string if the number is greater than the length of the string.
The kicker is that you CAN NOT use the built in charAt method.
Am I doing what it is asking correctly aside from not including the if statement? Also, what would a correct implementation of that look like? (New to JS so my apologies in advance).
function charAt(string, index) {
var charAt = string[index];
return charAt;
}