From 63573b81a6c6ef912357023c2b3d4babb8ead0fb Mon Sep 17 00:00:00 2001 From: Ibrahim Abouzeid Date: Fri, 30 Oct 2020 22:41:00 -0400 Subject: [PATCH] Add files via upload --- 03.02.01. stringLength.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 03.02.01. stringLength.js diff --git a/03.02.01. stringLength.js b/03.02.01. stringLength.js new file mode 100644 index 0000000..37187d9 --- /dev/null +++ b/03.02.01. stringLength.js @@ -0,0 +1,14 @@ +/* +Write a JS function that takes three string arguments as an input. +Calculate the sum of the length of the strings and the average length of the strings rounded down to the +nearest integer. +The input comes as three string arguments passed to your function. +The output should be printed on the console on two lines. +*/ +function main(str1, str2, str3){ + let sum = str1.length + str2.length + str3.length; + console.log(sum); + console.log(Math.floor(sum/3)); + +} +main('chocolate', 'ice cream', 'cake'); \ No newline at end of file