How do I make sure to print something on the same line?

I need to make a pattern program like this using for loop
*
**




However, both console.log() and print() shift the cursor to a new line.
Is there any method to print on screen without sending the cursor away?

2 Likes

You can include multiple variables in one console.log statement :

console.log(“Firstname” + firstName + " "+ “Lastname” + lastName)

Or

console.log(“First name %s Last name %s”, firstName, lastName)

Or
Let name = “Fuzzy Wuzzy”
console.out(’ ${name} had no hair. ')

1 Like