I have two questions about javascript and objects. The first one is:
I have this part of code:
const handleAnotherStep = () => {
let procedures =
{key:
{
stepType: {
stepCode: {
language: stepText,
timeout,
nextInstruction,
}
}
}
}
setProcedures(procedures)
console.log(procedures)
}
The key, stepType, stepCode, language, stepText, timeout and nextInstruction are in a useState(). The problem is: the console.log of this is:
[![enter image description here][1]][1]
But it should be like this :
[![enter image description here][2]][2]
You see? Instead of s'tepType', what should be written was the content of the stepType variable. Instead of the 'Key' the content of the key should be there. You get my point? Please, help me, I'm struggling in this and I'm newbie with JS. The nextInstruction and timeout are working just fine. I thin the javascript thinks the key, stepType, stepCode and language are a string, instead of a variable.
key,stepType,stepKey, these are all keys of an object. It's not clear how you want them to be variables. Also, how are you generating the output that you use in your images?case 'ProcedureCode': let k = e.target.value setKey(k) returnThe user writes it, and I set in a useState()