Today I had coding test of one company. I was given one question which I have faced following problem.
Input:
First line consists of an integer n representing the number of ID’s to be verified and the second line with n strings separated by a single space.
Output:
Display the entire ID’s that doesn’t satisfy the criteria(all ID should be of 6 digits)and if all the ID’s are valid, display 0.
Example 1:
Input
5
103010 12036 20260 2 661271
Output:
12036 20260 2
Example 2:
Input
6
123456 546788 235677 235980 457234
Output
0
Question was given
function sixthdigit (Countemployeeid) {
const Resultingid=[];
//write your code
return Resultingid;
}
var Countemployeeid =process.openStdin();
var Resultingid= sixthdigit (Countemployeeid) ;
console.log(Resultingid.length?Resultingid.join(''):0)
My question is the argument Countemployeeid
is contains two line, I can’t access the data from Countemployeeid
, is it array, how to extract the value from it?