How to use arrow function that return string array in TypeScript

1 Answer

0 votes
function display():string[] { 
   return new Array("xyz", "xzy", "yxz", "yzx", "zxy", "zyx") 
} 
  
const arr:string[] = display() 
 
for(let i in arr) { 
   console.log(arr[i]) 
}
  
    
      
      
/*
run:
      
"xyz" 
"xzy" 
"yxz" 
"yzx" 
"zxy" 
"zyx" 
      
*/

 



answered Oct 29, 2021 by avibootz
edited Nov 4, 2021 by avibootz

Related questions

1 answer 133 views
1 answer 138 views
1 answer 163 views
1 answer 221 views
2 answers 167 views
2 answers 213 views
...