Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

Javascript (ES6), 107 104 100 98 97 91 90 bytes

p=>{s=`/\\`.repeat(p++)+`
`;for(i=p;i>2;s+='\\'+o+o)o=`/ `.repeat(--i)+`
`;return s+'\\/'}

First post here!

Used to useUsed to use Array(len).join(str) but now usesbut now uses String.repeat(len), similar to Ruby's operator*(str,len).

Ungolfed:

len => {
    var str = `/\\`.repeat(len++) + '\n';

    for (var i = len, mid; i > 2; str += '\\' + mid + mid) {
        mid = `/ `.repeat(--i) + '\n';
    }

    return str + '\\/';
}

_Thanks to:_
_107 => 104 bytes: [@insertusernamehere](httphttps://codegolf.stackexchange.com/users/41859/insertusernamehere)_
_97 => 90 bytes: [@user81655](httphttps://codegolf.stackexchange.com/users/46855/user81655)_

Javascript (ES6), 107 104 100 98 97 91 90 bytes

p=>{s=`/\\`.repeat(p++)+`
`;for(i=p;i>2;s+='\\'+o+o)o=`/ `.repeat(--i)+`
`;return s+'\\/'}

First post here!

Used to use Array(len).join(str) but now uses String.repeat(len), similar to Ruby's operator*(str,len).

Ungolfed:

len => {
    var str = `/\\`.repeat(len++) + '\n';

    for (var i = len, mid; i > 2; str += '\\' + mid + mid) {
        mid = `/ `.repeat(--i) + '\n';
    }

    return str + '\\/';
}

_Thanks to:_
_107 => 104 bytes: [@insertusernamehere](http://codegolf.stackexchange.com/users/41859/insertusernamehere)_
_97 => 90 bytes: [@user81655](http://codegolf.stackexchange.com/users/46855/user81655)_

Javascript (ES6), 107 104 100 98 97 91 90 bytes

p=>{s=`/\\`.repeat(p++)+`
`;for(i=p;i>2;s+='\\'+o+o)o=`/ `.repeat(--i)+`
`;return s+'\\/'}

First post here!

Used to use Array(len).join(str) but now uses String.repeat(len), similar to Ruby's operator*(str,len).

Ungolfed:

len => {
    var str = `/\\`.repeat(len++) + '\n';

    for (var i = len, mid; i > 2; str += '\\' + mid + mid) {
        mid = `/ `.repeat(--i) + '\n';
    }

    return str + '\\/';
}

_Thanks to:_
_107 => 104 bytes: [@insertusernamehere](https://codegolf.stackexchange.com/users/41859/insertusernamehere)_
_97 => 90 bytes: [@user81655](https://codegolf.stackexchange.com/users/46855/user81655)_
91 => 90 bytes. Use `.repeat()`.
Source Link
rgajrawala
  • 737
  • 8
  • 23

Javascript (ES6), 107 104 100 98 97 9191 90 bytes

p=>{s=`/\\`.repeat(p++)+`
`;for(i=p;i>2;i=p;i>2;s+='\\'+o+o)o=`/ `.repeat(--i)+`
`,s+='\\'+o+o;return`;return s+'\\/'}

First post here!

Used to useUsed to use Array(len).join(str) but now usesbut now uses String.repeat(len), similar to Ruby's operator*(str,len).

Ungolfed:

len => {
    var str = `/\\`.repeat(len++) + '\n';

    for (var i = len;len, mid; i > 2; str += '\\' + mid + mid) {
        var mid = `/ `.repeat(--i) + '\n';
        str += '\\' + mid + mid;
    }

    return str + '\\/';
}

_Thanks to:_
_107 => 104 bytes: [@insertusernamehere](http://codegolf.stackexchange.com/users/41859/insertusernamehere)_
_97 => 9190 bytes: [@user81655](http://codegolf.stackexchange.com/users/46855/user81655)_

Javascript (ES6), 107 104 100 98 97 91 bytes

p=>{s=`/\\`.repeat(p++)+`
`;for(i=p;i>2;)o=`/ `.repeat(--i)+`
`,s+='\\'+o+o;return s+'\\/'}

First post here!

Used to use Array(len).join(str) but now uses String.repeat(len), similar to Ruby's operator*(str,len).

Ungolfed:

len => {
    var str = `/\\`.repeat(len++) + '\n';

    for (var i = len; i > 2; ) {
        var mid = `/ `.repeat(--i) + '\n';
        str += '\\' + mid + mid;
    }

    return str + '\\/';
}

_Thanks to:_
_107 => 104 bytes: [@insertusernamehere](http://codegolf.stackexchange.com/users/41859/insertusernamehere)_
_97 => 91 bytes: [@user81655](http://codegolf.stackexchange.com/users/46855/user81655)_

Javascript (ES6), 107 104 100 98 97 91 90 bytes

p=>{s=`/\\`.repeat(p++)+`
`;for(i=p;i>2;s+='\\'+o+o)o=`/ `.repeat(--i)+`
`;return s+'\\/'}

First post here!

Used to use Array(len).join(str) but now uses String.repeat(len), similar to Ruby's operator*(str,len).

Ungolfed:

len => {
    var str = `/\\`.repeat(len++) + '\n';

    for (var i = len, mid; i > 2; str += '\\' + mid + mid) {
        mid = `/ `.repeat(--i) + '\n';
    }

    return str + '\\/';
}

_Thanks to:_
_107 => 104 bytes: [@insertusernamehere](http://codegolf.stackexchange.com/users/41859/insertusernamehere)_
_97 => 90 bytes: [@user81655](http://codegolf.stackexchange.com/users/46855/user81655)_
97 => 91 bytes. Use `.repeat()`.
Source Link
rgajrawala
  • 737
  • 8
  • 23

Javascript (ES6), 107 104 100 98 9797 91 bytes

p=>{s=Arrays=`/\\`.repeat(++pp++).join`/\\`+`+`
`;for(i=p;i>2;)o=Arrayo=`/ `.repeat(i--i).join`/ `+`+`
`,s+='\\'+o+o;return s+'\\/'}

First post here!

UsesUsed to use Array(len).join(str) but now uses String.repeat(len), similar to Ruby's operator*(str,len).

Ungolfed:

len => {
    var str = Array(++len).join `/\\`.repeat(len++) + '\n';

    for (var i = len; i > 2; ) {
        var mid = Array(i--).join `/ `.repeat(--i) + '\n';
        str += '\\' + mid + mid;
    }

    return str + '\\/';
}

_Thanks! to:_
107_107 => 104 bytes: [@insertusernamehere](http://codegolf.stackexchange.com/users/41859/insertusernamehere)_
_97 => 91 bytes: [@user81655](http://codegolf.stackexchange.com/users/46855/user81655)_

Javascript (ES6), 107 104 100 98 97 bytes

p=>{s=Array(++p).join`/\\`+`
`;for(i=p;i>2;)o=Array(i--).join`/ `+`
`,s+='\\'+o+o;return s+'\\/'}

First post here!

Uses Array(len).join(str), similar to Ruby's operator*(str,len).

Ungolfed:

len => {
    var str = Array(++len).join `/\\` + '\n';

    for (var i = len; i > 2; ) {
        var mid = Array(i--).join `/ ` + '\n';
        str += '\\' + mid + mid;
    }

    return str + '\\/';
}

_Thanks!
107 => 104 bytes: [@insertusernamehere](http://codegolf.stackexchange.com/users/41859/insertusernamehere)_

Javascript (ES6), 107 104 100 98 97 91 bytes

p=>{s=`/\\`.repeat(p++)+`
`;for(i=p;i>2;)o=`/ `.repeat(--i)+`
`,s+='\\'+o+o;return s+'\\/'}

First post here!

Used to use Array(len).join(str) but now uses String.repeat(len), similar to Ruby's operator*(str,len).

Ungolfed:

len => {
    var str = `/\\`.repeat(len++) + '\n';

    for (var i = len; i > 2; ) {
        var mid = `/ `.repeat(--i) + '\n';
        str += '\\' + mid + mid;
    }

    return str + '\\/';
}

_Thanks to:_
_107 => 104 bytes: [@insertusernamehere](http://codegolf.stackexchange.com/users/41859/insertusernamehere)_
_97 => 91 bytes: [@user81655](http://codegolf.stackexchange.com/users/46855/user81655)_
98 => 97 bytes
Source Link
rgajrawala
  • 737
  • 8
  • 23
Loading
100 => 98 bytes. Remove '\n' for `{{\n}}`.
Source Link
rgajrawala
  • 737
  • 8
  • 23
Loading
104 => 102 bytes
Source Link
rgajrawala
  • 737
  • 8
  • 23
Loading
107 => 104 bytes. Thanks @insertusernamehere!
Source Link
rgajrawala
  • 737
  • 8
  • 23
Loading
Source Link
rgajrawala
  • 737
  • 8
  • 23
Loading