Pattern problem in js

I’m facing problem while creating any pattern in javascript console.log not printed the output in same line it . It prints on horizontal line

1 Like

@rish3ha
Please tag your TA or raise the question in correct category

2 Likes

In JavaScript, the console.log function prints output to the console, and by default, each call to console.log prints on a new line. If you want to print the output on the same line or create a pattern without new lines, you can use different approaches based on your requirement. Here are a few methods to achieve this:

:point_right:t3:Concatenation:
You can concatenate the strings or patterns you want to print on the same line before using console.log :
// Example pattern: **********
let pattern = ‘’;
for (let i = 0; i < 10; i++) {
pattern += ‘*’;
}
console.log(pattern); // Output: **********

1 Like

So the conclusion is c++ is best​:rofl::rofl:

1 Like

There’s alot new thighs to learn in JavaScript

1 Like

SURE SURE :grinning: :grinning: :grinning: :grinning: :grinning: :blush: :blush: