var dict = {
'thunder': 'severe thunderstorms',
'sun': 'thunderstorms',
'moon': 'mixed rain and snow',
'Rain': 'severe thunderstorms',
'Rain': 'thunderstorms',
'Rain': 'mixed rain and snow',
'Rain': 'mixed rain and sleet',
}
var result = String(state.cell.value.key);
/*How do I get
sun
/ \
thunder weather
\
rain
|- 'severe thunderstorms'
|- 'thunderstorms'
|- 'mixed rain and snow'
|- 'mixed rain and sleet'*/
答案 0 :(得分:1)
只需使用array:
var dict = {
thunder: 'severe thunderstorms',
sun: 'thunderstorms',
moon: 'mixed rain and snow',
rain: ['severe thunderstorms',
'thunderstorms',
'mixed rain and snow',
'mixed rain and sleet']
}
console.log(dict)