Search⌘ K
AI Features

Challenge: Functions

Explore how to write a JavaScript function that receives a string and returns its last character. This lesson helps you understand function definitions, parameters, and return values through practical coding exercise.

We'll cover the following...

Task

Write a function called lastChar that accepts a string as an argument and returns the last letter of the string.

Sample input 1:

 ...