Concepts
Strategy selection
Resolve a callable from a fixed registry of supported policies, and reject absent entries.
Formal Syntax & Structure
javascript syntaxjavascript
const strategy = strategies.get(name)Working Example
Example Snippetjavascript
(async () => {const fees=new Map([["standard",n=>n+2],["express",n=>n*2+3]]);const fee=(name,n)=>fees.has(name)?fees.get(name)(n):null;console.log(fee("standard",4),fee("express",4),fee("other",4));})()