mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
30 lines
352 B
JavaScript
30 lines
352 B
JavaScript
// Test that lvalue cannot be assigned to
|
|
|
|
var a = 0, b = 0;
|
|
try {
|
|
(true ? a : b) = 5;
|
|
result = false;
|
|
}catch(e){
|
|
result = true;
|
|
}
|
|
|
|
try {
|
|
(a && b) = 5;
|
|
result = false;
|
|
}catch(e){
|
|
result |= true;
|
|
}
|
|
|
|
try {
|
|
(a || b) = 5;
|
|
result = false;
|
|
}catch(e){
|
|
result |= true;
|
|
}
|
|
|
|
try {
|
|
(a ?? b) = 5;
|
|
result = false;
|
|
}catch(e){
|
|
result |= true;
|
|
} |