Skip to content

Instantly share code, notes, and snippets.

@ericdouglas
Created January 31, 2014 11:58
Show Gist options
  • Save ericdouglas/8730768 to your computer and use it in GitHub Desktop.
Save ericdouglas/8730768 to your computer and use it in GitHub Desktop.
Resolução do Exercício 01 do Capítulo 03 - JavaScript Eloquente
var numeroDeCamadas = 7,
contador = 1,
unidadeTijolo = "#",
tijolos = unidadeTijolo;
for ( ; contador <= numeroDeCamadas; contador += 1 ) {
console.log( tijolos );
tijolos += unidadeTijolo;
}
@camilaibs
Copy link

var triangle = '';
for (var i = 0; i < 7; i++) {
triangle += '#';
console.log(triangle);
}

@marcosabreudev
Copy link

marcosabreudev commented Oct 12, 2017

var text = '';
for(let i=0; i<7; i++) {
     console.log(text += '#');
}

@silvaitamar
Copy link

for(var i = 1; i < 8; i++){
for(var j = 1; j <= i; j++){
console.log('#');
}
console.log('\n')
}

@matheusicaro
Copy link

var aux = 0;
var rast = "#";

while (aux < 7){
    console.log(rast);
    rast += "#";
    aux++;
}

@maira-o
Copy link

maira-o commented Dec 23, 2017

    var impressao = "#";
    var simbolo = '#';
    
    for (var i = 0; i < 7; i++) {
        console.log(impressao);
        impressao += simbolo;
    }

@lcdanella90
Copy link

lcdanella90 commented Apr 9, 2018

for (var hash = '', i = 0; i <= 7; i++ ){
    hash += '#'
    console.log(hash);
}

@alexandreruoso
Copy link

alexandreruoso commented Apr 20, 2018

for ( num=0; num<= 7; num++ ) console.log( "#".repeat(num) );

@eduardosacra
Copy link

`var piramede =
function(altura) {
var ep = altura;
for(var alt = 1; alt < altura; alt++){
var linha = "";
for(espaco = ep; espaco >0; espaco--){
linha += " ";
}
ep--;
for(var caracter = 1; caracter < alt*2; caracter++){
linha += "#";
}
console.log(linha);
}

}`

@lussolli
Copy link

lussolli commented Jul 4, 2018

let caractere = '';
let i;

for (i = 0; i < 7; i++) {
    console.log(caractere + '#');
    caractere += '#';
}

@domeniqque-pereira-deel
Copy link

for (let i = 0; i <= 7; i++) 
  console.log('#'.repeat(i));

@augustorodrigues
Copy link

augustorodrigues commented Nov 2, 2018

for (let hash = "#"; hash.length <= 7; hash += "#") {  
    console.log(hash);
}

@alexandreramosdev
Copy link

let hash = '';
for(let i = 0; i < 7; i++){
  hash += '#';
  console.log(hash);
}
// #
// ##
// ###
// ####
// #####
// ######
// #######

@Hamiltonspjunior
Copy link

var hash = '';
for(var i = 0; i<7; i++){
	console.log(hash += '#');
}

@otoledomario
Copy link

let asterisco = '#'
for(let i = 0; i < 7; i++){
console.log(asterisco)
asterisco += '#'
}

@otoledomario
Copy link

let asterisco = '#'
for(let i = 0; i < 7; i++){
  console.log(asterisco)
  asterisco += '#'
}

@weritontmachado
Copy link

var line = "";
for (var i=1;i<=7;i++){ 
	console.log(line += '#');
}

@leanfj
Copy link

leanfj commented Apr 17, 2019

function desenhaPiramide(altura, caractere){
  let elemento = caractere;
  for(let i = 0; i <= altura; i++){
    console.log(elemento);
    elemento += caractere;
  }
}

@wesley-snybool
Copy link

let hash = ''

for(let i=0; i<7; i++){
hash += '#'
console.log(hash)
}

@johanbacks
Copy link

` var number = ""
for (var i = 1 ; i <= 7; i++) {

number += "#";
console.log(number);
}

`

@daviassumpcao
Copy link

var a = '';
for (var i = 0; i <7; i++){
a += '#';
console.log(a);
}

@oastro
Copy link

oastro commented Aug 2, 2020

var twitter = "";

for( x = 0; x < 7; x++){
twitter += "#"
console.log(twitter);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment