0

Javascript Problem

// Write a function that takes a string (a) as argument // Extract the first half a // Return the result function myFunction(a){ return } What is the question? Can anyone explain me please?.

25th Jun 2022, 3:04 PM
Sachin
Sachin - avatar
1 Answer
0
function getSubStr(s){ let pos = parseInt( s.length/2 ); return s.substring(0, pos); // Extract the first half } let str = "sololearn"; console.log( getSubStr(str) );
25th Jun 2022, 3:28 PM
SoloProg
SoloProg - avatar