Skip to content

Commit 4c5fe4a

Browse files
committed
[HW-6.8/st-compl] can-drive
Displaying relevant msg according execution/chain of "logical" opr's. Worth noting: - the possibilities of "template" strings and "ternary" operators. FS-dev: B-3 / JS basic
1 parent 614e168 commit 4c5fe4a

File tree

1 file changed

+15
-0
lines changed
  • full-stack-dev/3-js-basic/6-boolean-logic/6-8-hw-3-can-drive

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Написать код (одной строкой), который позволяет проверить возможность вести машину по следующим параметрам:
2+
// hasLicence - имеет права
3+
// age - возраст
4+
// isDrunk - пьян
5+
6+
const hasLicence = true;
7+
const age = 21;
8+
const isDrunk = false;
9+
10+
const canDrive = hasLicence && age >= 18 && !isDrunk;
11+
console.log(
12+
`Данный человек может вести машину? ${
13+
canDrive ? 'Да, может!' : 'Нет.. не может!'
14+
}`
15+
); // Данный человек может вести машину? Да, может!

0 commit comments

Comments
 (0)