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

172
Views
¿Alguien puede decirme por qué recibo el error ".toFixed no es una función"
import React from "react"; import { useContext } from "react"; import styled from "styled-components"; import { GlobalContext } from "../context/GlobalState"; import IncomeTransactions from "./IncomeTrasactions"; function Head() {

En esta parte dibujo un mes y un año

 let months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ]; let mY = new Date(); let monthName = months[mY.getMonth()]; const current = new Date(); const date = `${current.getFullYear()}`; const { incomeTransactions, expenseTransactions } = useContext(GlobalContext); const incomeAmounts = incomeTransactions.map( (incomeTransaction) => incomeTransaction.incomeAmount ); const expenseAmounts = expenseTransactions.map( (expenseTransaction) => expenseTransaction.expenseAmount );

En esta sección, aparece el error "expenseAmounts.reduce(...).toFixed is not function"

 const totalIncome = incomeAmounts .reduce((acc, item) => (acc += item), 0) .toFixed(2); const totalExpense = expenseAmounts .reduce((acc, item) => (acc += item), 0) .toFixed(2);

El código a continuación está bien y todo funciona, el problema está en algún lugar donde lo marqué como devolución (Presupuesto disponible en {monthName} {date}

{ingresos totales - gastos totales}.00

Ingreso

 <div>+ {totalIncome}</div> </div> <div className="expenses-top mt-3"> <div>Expenses</div> <div>- {totalExpense}</div> </div> </BlockHeader> <ImageHeader src="/img/header-budget.png" /> </Wrap> </div> ); } export default Head;
about 4 years ago · Juan Pablo Isaza
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!