@@ -233,7 +233,6 @@ const str = "Md Nazmul islam";
233233const newStr = str.split("").reverse().join("");
234234console.log(newStr);
235235
236-
237236// #27: Create a function that takes an array and returns the types of values (data types) in a new array.
238237
239238const arrayValuesTypes = (arr) => {
@@ -250,7 +249,6 @@ console.log(arrayValuesTypes([1, 2, "Nazmul", [], true]));
250249const arrayValuesTypes = (arr) => arr.map((x) => typeof x);
251250console.log(arrayValuesTypes([1, 2, "Nazmul", [], true]));
252251
253-
254252// #28: Create a function that will return in an array. becarefull function parameter and array length is same in count.
255253function getArray(number) {
256254 var newArray = [];
@@ -270,8 +268,22 @@ console.log(getArray(5));
270268const calcAge = (age) => (age < 0 || typeof age != "number" ? null : age * 365);
271269console.log(calcAge(5));
272270
273- */
274-
275271// #30: Create a function that takes voltage and current and returns the calculated power.
276272const circuitPower = (voltage, current) => voltage * current;
277273console.log(circuitPower(115, 5));
274+
275+ // #31: Given two numbers, return true if the sum of both numbers is less than 50. Otherwise return false.
276+ function lessThan50(a, b) {
277+ if (a + b < 50) {
278+ return true;
279+ } else {
280+ return false;
281+ }
282+ }
283+ console.log(lessThan50(40, 30));
284+
285+ // Or ShortCut
286+ const lessThan50 = (a, b) => a + b < 50;
287+ console.log(lessThan50(30.15));
288+
289+ */
0 commit comments