Javascript is dynamically typed language (same as Python) with C/C++ compaterble syntax that look at the same for Java and C# also
let trueValue = true
let falseValue = false
trueValue = True
falseValue = False
true && false == false // Conjunction
true || false == true // Disjunction
true ^ true == false // XOR
(true != true) == false // Not equal
let empty = ''
(empty === falseValue) == false // Strict equal
True and False == False # Conjunction
True or False == True # Disjunction
(True != True) == False # Not equal
empty = ''
(empty == falseValue and (type(empty) == type(falseValue))) == False # Strict equal
trueValue &= false
false == trueValue
trueValue = trueValue and False
False == trueValue
let trueValue = true
let truthValue
if (trueValue) {
truthValue = true
} else {
truthValue = false
}
const rightValue = trueValue ? true : false
rightValue === trueValue
trueValue = True
if trueValue:
truthValue = True
else:
truthValue = False
from typing import Final
if trueValue:
rightValue: Final = True
else:
rightValue: Final = False
let integerValue = 2
let floatValue = 0.5
integerValue * floatValue === 1
let hexNumber = 0x10
let octNumber = 010
let binaryNumber = 0b10
hexNumber == octNumber * binaryNumber
trueValue = True
integerValue = 2
floatValue = 0.5
integerValue * floatValue == 1
hexNumber = 0x10
octNumber = 0o10
binaryNumber = 0b10
hexNumber == octNumber * binaryNumber
const last = 9
let digits = []
for(let i = 0; i <= last; i++) {
digits.push(i)
}
digits.push(null)
console.log(digits)
for(const i of digits) {
try {
console.log(`${i}: ${i == digits[i]}`)
} catch (err) {
console.error(err)
} finally {
console.log(`Value ${i}: ${digits[i]}`)
}
}
let j = digits.length - 1
while(j >= 0) {
if (typeof digits[j] === 'number')
digits[j] = last - j
else
digits.splice(j, 1)
}
last = 9
digits = []
for i in range(10):
digits.append(i)
digits.append(None)
print(digits)
for number in digits:
try:
print('%i: %s' % (number, number == digits[number]))
except Exception as err:
print(err)
finally:
print('Value %s' % (number))
j = len(digits) - 1
while j >= 0:
if type(digits[j]) == int:
digits[j] = last - j
else:
digits = digits[:j] + digits[j+1:]
j -= 1
print(digits)