i want to create a variable like this in javascript
variable1.varible2.variable3 = "Hi Its working";
alert(variable1.varible2.variable3);
You cannot have . in variable names.
You can call a variable pretty much anything you like, but there are limitations. Generally, you should stick to just using Latin characters (0-9, a-z, A-Z) and the underscore character.
If you really want the variable1.varible2.variable3 to return value "Hi Its working". You can use objects.
let variable1 = {
variable2:{
variable3:"Soemthing"
}
}
console.log(variable1.variable2.variable3)
variable1.somethingcan now mean multiple things.variable1, which has a propertyvariable2that holds another object, then you can set a property calledvariable3on it with that code. But it doesn't, and can't, assign to a new variable. The.character is not legal in a JS identifier.