Skip to content

Commit f3eb221

Browse files
added new solved vat calculation and calid phone number
1 parent 0140278 commit f3eb221

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
function validContact(contact) {
2+
if (contact.length === 11 && contact.startsWith("01") && !contact.includes(" ")) {
3+
return true;
4+
}
5+
else if (typeof contact !== 'string') {
6+
return "Invalid";
7+
}
8+
else {
9+
return false;
10+
}
11+
}
12+
const number = validContact(true);
13+
console.log(number);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function calculateVAT(price) {
2+
if (typeof price !== 'number' || price < 0) {
3+
return "Invalid";
4+
}
5+
else {
6+
const productVat = price * 7.5 / 100;
7+
return productVat;
8+
}
9+
}
10+
const result = calculateVAT(1000);
11+
console.log(result);

0 commit comments

Comments
 (0)