bigskysoftware / bigskysoftware/_hyperscript
iterate object properties
- Lingua principale
- JavaScript
- Stelle
- 3.8k
- Fork
- 172
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I tried something that was not documented: "Iterate over an object"
code:
```
init
set $o to { name: "john", age: 30 }
for value in $o index key
log key
log value
end
end
```
But I could not get it working. Trying multiple methods, most of them resulted into an error.
console:
```
Uncaught TypeError: i.iterator is undefined
op https://unpkg.com/hyperscript.org:1
unifiedEval https://unpkg.com/hyperscript.org:1
unifiedExec https://unpkg.com/hyperscript.org:1
execute https://unpkg.com/hyperscript.org:1
o https://unpkg.com/hyperscript.org:1
setTimeout handler*install https://unpkg.com/hyperscript.org:1
apply https://unpkg.com/hyperscript.org:1
initElement https://unpkg.com/hyperscript.org:1
processNode https://unpkg.com/hyperscript.org:1
forEach https://unpkg.com/hyperscript.org:1
processNode https://unpkg.com/hyperscript.org:1
w https://unpkg.com/hyperscript.org:1
n https://unpkg.com/hyperscript.org:1
w https://unpkg.com/hyperscript.org:1
promise callback*w https://unpkg.com/hyperscript.org:1
https://unpkg.com/hyperscript.org:1
https://unpkg.com/hyperscript.org:1
```
Since this works in normal javascript I think there must be a way to do this in hyperscript.
Please let me know how to do this.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia riproducendo lo snippet HTML hyperscript dell’issue con l’oggetto contenente name e age, quindi esamina come il for-loop esistente gestisce il proprio input. Conferma come le proprietà dell’oggetto debbano esporre key e value, e considera completato il lavoro quando l’esempio itera senza il TypeError segnalato e registra entrambe le proprietà.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- web-dev
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100