Skip to content

Commit 2e67f52

Browse files
authored
Update javascript-conditional-examples.js
1 parent 257db0b commit 2e67f52

File tree

1 file changed

+22
-42
lines changed

1 file changed

+22
-42
lines changed

javascript-conditional-examples.js

Lines changed: 22 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -85,53 +85,33 @@ if (flavor === ("vanilla" || "chocolate") || vessel === ("cone" || "bowl") ||
8585
console.log("No Ice cream");
8686
}
8787

88+
/*
8889
89-
// change the values of `shirtWidth`, `shirtLength`, and `shirtSleeve` to test your code
90-
//currently not finished yet!
91-
var shirtWidth = 19;
92-
var shirtLength = 28;
93-
var shirtSleeve = 8.39;
94-
95-
// your code goes here
96-
if ((shirtWidth >= 18 || shirtWidth < 20) && shirtLength === 28 && shirtSleeve <= 8.38 ) {
97-
console.log("small (S)");
98-
} else if (shirtWidth < 20 && shirtLength === 29 && shirtSleeve < 8.38 ) {
99-
console.log("medium (M)");
100-
} else if (shirtWidth < 22 && shirtLength === 30 && shirtSleeve < 8.63 ) {
101-
console.log("large (L)");
102-
} else if (shirtWidth < 24 && shirtLength === 31 && shirtSleeve < 8.88 ) {
103-
console.log("extra large (XL)");
104-
} else if (shirtWidth < 26 && shirtLength === 33 && shirtSleeve < 9.63 ) {
105-
console.log("extra extra large (2XL)");
106-
} else if (shirtWidth < 28 && shirtLength === 34 && shirtSleeve < 10.13 ) {
107-
console.log("extra extra extra large (3XL)");
108-
} else {
109-
console.log("N/A");
110-
}
90+
Programming Quiz: What do I Wear? (3-7)
91+
*/
11192

112-
// or
113-
var shirtWidth = 19;
114-
var shirtLength = 28;
115-
var shirtSleeve = 8.39;
93+
// change the values of `shirtWidth`, `shirtLength`, and `shirtSleeve` to test your code
94+
var shirtWidth = 23;
95+
var shirtLength = 30;
96+
var shirtSleeve = 8.71;
11697

11798
// your code goes here
118-
if ((shirtWidth >= 18 || shirtWidth < 20) && shirtLength === 28 && shirtSleeve <= 8.38 ) {
119-
console.log("small (S)");
120-
} else if ((shirtWidth >= 20 || shirtWidth < 22) && shirtLength === 29 && shirtSleeve < 8.63 ) {
121-
console.log("medium (M)");
122-
} else if ((shirtWidth >= 22 || shirtWidth < 24) && shirtLength === 30 && shirtSleeve < 8.88 ) {
123-
console.log("large (L)");
124-
} else if ((shirtWidth >= 24 || shirtWidth < 26) && shirtLength === 31 && shirtSleeve < 9.63 ) {
125-
console.log("extra large (XL)");
126-
} else if ((shirtWidth >= 26 || shirtWidth < 28) && shirtLength === 33 && shirtSleeve < 10.13 ) {
127-
console.log("extra extra large (2XL)");
128-
} else if ((shirtWidth >= 28 || shirtWidth < 30) && shirtLength === 34 && shirtSleeve === 10.13 ) {
129-
console.log("extra extra extra large (3XL)");
130-
} else {
131-
console.log("N/A");
99+
if ((shirtWidth >= 18 && shirtWidth < 20) && (shirtLength >= 28 && shirtLength < 29) && (shirtSleeve >= 8.13 && shirtSleeve < 8.38)) {
100+
console.log("S");
101+
} else if ((shirtWidth >= 20 && shirtWidth < 22) && (shirtLength >= 29 && shirtLength < 30) && (shirtSleeve >= 8.38 && shirtSleeve < 8.63)) {
102+
console.log("M");
103+
} else if ((shirtWidth >= 22 && shirtWidth < 24) && (shirtLength >= 30 && shirtLength < 31) && (shirtSleeve >= 8.63 && shirtSleeve < 8.88)) {
104+
console.log("L");
105+
} else if ((shirtWidth >= 24 && shirtWidth < 26) && (shirtLength >= 31 && shirtLength < 33) && (shirtSleeve >= 8.88 && shirtSleeve < 9.63)) {
106+
console.log("XL");
107+
} else if ((shirtWidth >= 26 && shirtWidth < 28) && (shirtLength >= 33 && shirtLength < 34) && (shirtSleeve >= 9.63 && shirtSleeve < 10.13)) {
108+
console.log("2XL");
109+
} else if (shirtWidth >= 28 && shirtLength >= 34 && shirtSleeve >= 10.13) {
110+
console.log("3XL");
111+
} else {
112+
console.log("N/A");
132113
}
133114

134-
135115
//A value is falsy if it converts to false when evaluated in a boolean context.
136116
//For example, an empty String "" is falsy because, "" evaluates to false
137117
if ("") {
@@ -369,4 +349,4 @@ if (musicians <= 0) {
369349
});
370350

371351
$(window).trigger('resize');
372-
</script>
352+
</script>

0 commit comments

Comments
 (0)