Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

253
Views
How to add Multiply any number with index of array in node.js using hbs engine?
{{#each myArray}}
<div class="product-default-single-item product-color--golden" data-aos="fade-up" data-aos-delay="{{@index * 200}}">
</div>
{{/each}}

This is my code . I want a dynamic delay to all contents which added dynamically. For example if i add another product in mongodb then i want to multiply his index to 200. @index is working fine . I'm getting @index but Multiply() or Add(+) is not working. when i add multiply() or add (+). It give me error.

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Here is the answer from my point of view. First you need to create a custom helper here is the code example

hbs.registerHelper("multiple",function(index,value){
    return index * value;
}


{{#each myArray}}
    <div class="product-default-single-item product-color--golden" data-aos="fade-up" data-aos-delay="{{#multiple @index 200}}{{/multiple}}">
    </div>
{{/each}}
//Let the myArray length is 2
// The output will be 0 and 200
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!