Advertisement
dimipan80

Variables

Nov 9th, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Write a JavaScript function variablesTypes(arr) that accepts the following parameters:
  2. name, age, isMale (true or false), array of your favorite foods. The function must return
  3. the values of the variables and their types. */
  4.  
  5. "use strict";
  6.  
  7. function variablesTypes(arr) {
  8.     console.log('"My name: ' + arr[0] + ' //type is ' + typeof (arr[0]));
  9.     console.log('My age: ' + arr[1] + ' //type is ' + typeof (arr[1]));
  10.     console.log('I am male: ' + arr[2] + ' //type is ' + typeof (arr[2]));
  11.     console.log('My favorite foods are: ' + arr[3]);
  12.     console.log('//type is ' + typeof (arr[3]) + '"');
  13. }
  14.  
  15. variablesTypes(['Pesho', 22, true, ['fries', 'banana', 'cake']]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement