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

155
Views
I am getting syntax error while using foreach in javascipt. I am trying to create a function to increase and decrease the text size on my page

This is the code I am trying to use to create a function to increase/ decrease text size on my page: this is the error i get: "main.js (65,19) Syntax error"

function changeFontsize(type)
{
    let ids = ["#h3", "#p" ];
    
    ids.forEach( id => {
        
        let el = document.querySelector(id);
        
        
        let fontSize = window.getComputedStyle(el, null).getPropertyValue("font-size");
        
        
        fontSize = parseFloat.(fontSize);
        
        
        if(type === "increase")
        {
            el.style.fontSize = (fontSize + 5) + "px" ;
            
        }
        else 
        {
           el.style.fontSize = (fontSize - 5) +"px";    
        
        }
        
        
        
    });
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Syntax error is in this line:

parseFloat.(fontSize)

Remove .:

parseFloat(fontSize)
about 4 years ago · Juan Pablo Isaza 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!