Creating and "if" statement that activates

Hello guys, I been trying for 3 days making this code to work but cleared I couldnt pass trough this step so I was wondering if anyone could teach me how to create an “if” statement that activates with ceratins numbers.

(my code

 let arr =[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
for(var i=0; i < arr.length; i++){
console.log(i);
}

alright explain the thing you want

I made it =D,

let arr =[];
for(i=1;i<=15;i++)
arr.push(i);
for(let i=0;i < arr.length;i++)
{

if (arr[i] >= 3 && arr[i] <= 7)

{console.log(arr[i]);
}}

Now, I have another problem xD. See, now I have use the same code but in this case it suppost the code have to shows certain values: 1,2,8,10,10,11,12,13,14,15. How? I dont know :man_shrugging:

I did it!!!

let arr =[];
for(i=1;i<=15;i++)
arr.push(i);
for(let i=0;i < arr.length;i++)
{

if (arr[i] >=1  && arr[i] <= 2 || arr[i] >=8 && arr[i] <=15)
  

{console.log(arr[i]);
}}

I had a crazy night last night, my head is hurt xD

awesome that you made it!


I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).