Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function starString(x){
- var str = '';
- if (typeof(x) == 'number'){
- for(var i=0;i<x;i++){
- str += '*';
- }
- }
- return str;
- }
- function drawStars(x){
- for(var i=0;i<x.length;i++){
- if (typeof(x[i])=='number')
- console.log(starString(x[i]));
- if (typeof(x[i])=='string'){
- var str='';
- for(var j=0;j<x[i].length;j++){
- str+=x[i][0].toLowerCase();
- }
- console.log(str);
- }
- }
- }
- console.log(starString(8));
- console.log(drawStars([4, "Tom", 1, "Michael", 5, 7, "Jimmy Smith"]));
Add Comment
Please, Sign In to add comment