Question: Simple JS task that implement a template function Implement a JavaScript class that when supplied with a templateincluding tags enclosed in double curly braces (

Simple JS task that implement a template function

Implement a JavaScript class that when supplied with a templateincluding tags enclosed in double curly braces ( e.g. {{sometag}})produces a string with the tags replaced by values found in aname-value-pair map i.e. a simple JavaScript object.

For example, after running the following code:const t = newTemplater('Hello {{tag}}');let s = t.apply({tag: 'World'});Thevariable swill have the value 'Hello World'.

How does this work ?

Step by Step Solution

3.48 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer JAVASCRIPT PROGRAM class Templater constructorwords parameterised constr... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!