Connect with one of the following accounts


Please wait while we redirect...

Views: 200   

Its a very common usecase where you want to make some functions available to your ejs files. Following code shows you how to make that possible.

In the following example we are adding a function square which takes a number and return the square value for that number. We will use this function in ejs file.

At index.js file

function square(inp){
  return (inp * inp);

At foo.ejs file

<p> <%=square(5)%> </p>

On By

Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News