Interpolation Syntax

 Interpolation Syntax refers to the embedding expressions into marked up text

in HTML whatever we write as a code it prints in the same way, but by using EJS we can convert into dynamic 

using EJS tags 

  • <% 'Scriptlet' tag, for control-flow, no output
  • <%_ ‘Whitespace Slurping’ Scriptlet tag, strips all whitespace before it
  • <%= Outputs the value into the template (HTML escaped)
  • <%- Outputs the unescaped value into the template
  • <%# Comment tag, no execution, no output
  • <%% Outputs a literal '<%'
  • %> Plain ending tag
  • -%> Trim-mode ('newline slurp') tag, trims following newline
  • _%> ‘Whitespace Slurping’ ending tag, removes all whitespace after it


<h1>Demo for INTERPOLATION SYNTAX 1+2</h1>
    <h2><%= 1+2 %></h2>
    <h1>Demo for INTERPOLATION SYNTAX  "Abhii"</h1>
    <h2><%= "Abhii"%></h2>
    <h1>Demo for INTERPOLATION SYNTAX  array"</h1>
    <h2><%= ["Abhii","Hello","hiii"] [2]%></h2>


Comments

Popular posts from this blog

DATABASE RELATIONSHIPS

ROUTING (GET /) home route

Query Strings