A Redundant Function

Published by bangyen in

Write a function that takes in a string s and returns a function that returns s.

Examples

let f1 = redundant("apple")
f1() ➞ "apple"

let f2 = redundant("pear")
f2() ➞ "pear"

let f3 = redundant("")
f3() ➞ ""

Notes

Your function should return a function, not a string.

Watch a quick demo on how Edabit works.