let heart = "";
let size = 6;
// Loop to print upper part of the heart
for (let i = size / 2; i <= size; i += 2) {
for (let j = 1; j < size - i; j += 2) {//spaces on left
heart += " "; // Double space for consistent spacing
}
for (let j = 1; j <= i; j++) { // hearts in middle left
heart += "❤️ ";
}
for (let j = 1; j <= size - i; j++) {//spaces b/w two halves
heart += " "; // Double space
}
for (let j = 1; j <= i; j++) { //heart in middle right
heart += "❤️ ";
}
heart += "\n";
}
// Loop to print bottom part of the heart
for (let i = size; i >= 1; i--) {
// Print spaces on the left side
for (let j = i; j < size; j++) {
heart += " "; // Double space
}
for (let j = 1; j <= (i * 2) - 1; j++) { //hearts bottom part
heart += "❤️ ";
}
heart += "\n";
}
console.log(heart);
CKEditor 5 gives you full control over your editing experience. A modular architecture means you get high performance, fewer re-renders and a setup that scales with your needs.
Dive into this insightful write-up, celebrated within the collaborative DEV Community. Developers at any stage are invited to contribute and elevate our shared skills.
A simple "thank you" can boost someone’s spirits—leave your kudos in the comments!
On DEV, exchanging ideas fuels progress and deepens our connections. If this post helped you, a brief note of thanks goes a long way.
Top comments (0)