I want to make a variable a specific value, when a value originally wanted to put is undefined
Like this in shell script
VALUE=${VALUE1:-0}
This means, if there is no VALUE1, then VALUE = 0
How can I put a specific value instead of undefined?
data() {
return {
value1: 0,
value2: process.env.VALUE2 | '', // If process.env.VALUE2 is undefined then make value2 ''
}
},
You could make use of the ? operator.
for example, you could check whether there is any value in process.env.VALUE2 like the following:
let variable = process.env.VALUE2 ? 'there is value' : 0
Does process.env.VALUE2 have value? If yes then assign 'there is value' to variable else assign 0 to variable