Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function result(values) {
- let stringArr = [];
- let strCount = 0;
- let numberArr = [];
- let numCount = 0;
- let funcArr = [];
- let funcCount = 0;
- for (let i = 0; i <= arguments.length; i++) {
- if (typeof arguments[i] == 'string') {
- stringArr.push(arguments[i])
- strCount++;
- }
- else if (typeof arguments[i] == 'number') {
- numberArr.push(Number(arguments[i]));
- numCount++;
- }
- else if (typeof arguments[i] == 'function') {
- funcArr.push(arguments[i]);
- funcCount++;
- }
- }
- console.log('string: ' + stringArr.join(', '))
- console.log('number: ' + numberArr.join(', '))
- console.log('function: ' + funcArr.join(', '))
- console.log('string = ' + strCount)
- console.log('number = ' + numCount)
- console.log('function = ' + funcCount)
- }
- result('cat', 42, 'dog', function () { console.log('Hello world!') });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement