It's not necessary to assign the input to a variable here. The body of the method could just be:
string.slice(0, int)

Nice solution :)