Skip to content
Advertisement

How to implements pattern for below logic? [closed]

I tried with

JavaScript

And I got

Cheap 
Cheap flights 
Cheap flights from 
Cheap flights from New 
Cheap flights from New York 
Cheap flights from New York to 
Cheap flights from New York to United 
Cheap flights from New York to United Kingdom 

I 
I am
I am a
I am a girl

am
am a
am a girl

a
a girl

girl

Advertisement

Answer

Here you need to introduce one more for loop to get your desired output.

JavaScript
Advertisement