Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions 03.02.01. stringLength.js
Original file line number Diff line number Diff line change
@@ -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');