← Back to challenges

Magic Function

JavaScriptHardhigher_order_functionsclosuresfunctional_programminglanguage_fundamentals

Instructions

Create a function that calls an object property with procedural like style.

Examples

magic.replace("azerty", "a", "A") ➞ "Azerty"

magic.length("hello word") ➞ 10

magic.trim("  javascript is awesome  ") ➞ "javascript is awesome"

magic.normalize("éèê", "NFD") ➞ e ́  e ̀  e ̂

magic.slice([1, 2, 3, 4, 5], 2, 4) ➞ [ 3, 4 ]

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.