Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

143
Visualizações
Sorting - methods and properties of objects

enter image description here

Hey stackoverflow, I was working on a project that was meant to take the methods and properties of different API's and then making a system that would allow these to be chained together and used with less technical knowledge.

One of the basic requirements of this project is being able to parse out an object into its properties and its functions. Having tried a couple of different approaches with no luck, I noticed (see picture) that vscode could tell what parts of an object are methods and which are properties, which left me wondering how i could actually utilize this functionality, as in is there a function that would return all the properties of an object?

I know Object.keys() returns the string value of all the keys of an object, which is a good start, but i also need the actual objects held by these keys.

I've also stumbled onto Object.getPrototypeOf(obj), which returns the prototype of a function, and at least as far as i understand the prototype holds all the methods, and as such we should be able to go through all the prototypes nested inside the first prototype to find all the methods we can use. (atleast this is what im attempting next) One of the concerns I'm imagining is that some methods are also held in keys, and these wouldn't be caught in this way, I'm imagining.

So my overarching question is if there's a smart way to access these properties and methods or to simply sort it outright

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use Object.entries() and get both, key and value // -> [[key, value], [key, value]]

Try:

let list = Object.entries(window).map(([key, value]) => ({[key]: typeof value}))

console.log(list)
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda