Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

104
Vistas
How to get all values in a data table

I am trying to get all the values in a JavaScript data table but whenever I try it says, "table.length is not a function" or, "table.size is not a function" (I've tried both).

Here is the code I want to use:

const wordcount = {"this", "is", "a", "data", "table"}

console.log(wordcount.size()) // wordcount.size is not a function

I want it to return an integer value to the console. How would I do this?

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

In the first line, Object's type is not true.

If you want to loop object, here is sample code.

// Object Loop
const wordcount = {
    key1: "this", 
    key2: "is", 
    key3: "a", 
    key4: "data", 
    key5: "table"
}
for (let key in wordcount) {
    console.log(wordcount[key])
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

Word count is not an valid array, see the code below it should work fine

const wordCount = ['this', 'is', 'a', 'data', 'table']

console.log(wordCount.length)

An array should always start with this '[' and end with this ']' not with '{'

about 4 years ago · Juan Pablo Isaza Denunciar

0

I think I got your question wrong are you trying to make a data table? A data table must only contain primitive values such as string, number, Boolean, null, undefined etc.

// sample code 
const data = {
   name: "Jhon",
   age: 25,
   isChild: false,
 }

Note: size is not a function it is an attribute

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda