Concatenating First and Last Character of a String

Published by BijogFc24 in

Create a function that takes a string and returns the concatenated first and last character.

Examples

firstLast("ganesh") ➞ "gh"

firstLast("kali") ➞ "ki"

firstLast("shiva") ➞ "sa"

firstLast("vishnu") ➞ "vu"

firstLast("durga") ➞ "da"

Notes

There is no empty string.

Watch a quick demo on how Edabit works.