Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function result(values) {
- let stringArr = {};
- let strCount = 0;
- let numberObj = {};
- let numCount = 0;
- let numberArr = {}
- let funcArr = {};
- let funcCount = 0;
- for (let i = 0; i < arguments.length; i++) {
- if (typeof arguments[i] == 'string') {
- stringArr.string = arguments[i]
- console.log(stringArr)
- strCount++;
- }
- else if (typeof arguments[i] == 'number') {
- numberObj.number = arguments[i];
- numCount++;
- console.log(numberObj)
- }
- else if (typeof arguments[i] == 'function') {
- funcArr.function = arguments[i]
- funcCount++;
- console.log(funcArr)
- }
- }
- 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