Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
5 Greatly reduced code size
source | link

JavaScript (ES6): 63 62 56 5252 32 bytes

Thanks to nderscore for greatly reducing the size of the code.

point=p=(a,b)=>=>b+`\n${return' b+"\n"+Array(a)'.joinrepeat(" "a)+" ^"}^`

Version that works across allmore browsers (5847 bytes):

point=functionp=function(a,b){return b+"\n"+Array(a)b+`\n${' '.joinrepeat(" "a)+" ^"}^`}

JavaScript (ES6): 63 62 56 52 bytes

point=(a,b)=>{return b+"\n"+Array(a).join(" ")+" ^"}

Version that works across all browsers (58 bytes):

point=function(a,b){return b+"\n"+Array(a).join(" ")+" ^"}

JavaScript (ES6): 63 62 56 52 32 bytes

Thanks to nderscore for greatly reducing the size of the code.

p=(a,b)=>b+`\n${' '.repeat(a)}^`

Version that works across more browsers (47 bytes):

p=function(a,b){return b+`\n${' '.repeat(a)}^`}
4 Compacted it even further, removed source now that it's one line anyway
source | link

JavaScript (ES6): 63 62 5656 52 bytes

point=(a,b)=>{c=Arrayreturn b+"\n"+Array(a).join(" ")+" ^";return b+"\n"+c^"}

Version that works across all browsers (6258 bytes):

point=function(a,b){c=Arrayreturn b+"\n"+Array(a).join(" ")+" ^";return b+"\n"+c}

Source:

point = function(pointerLocation, string) {
    spaces = "";
    for(i=0; i < pointerLocation; i++) {
        spaces += " ";
    };
    return string + "\n" + spaces +"^";
^"}

JavaScript (ES6): 63 62 56 bytes

point=(a,b)=>{c=Array(a).join(" ")+" ^";return b+"\n"+c}

Version that works across all browsers (62 bytes):

point=function(a,b){c=Array(a).join(" ")+" ^";return b+"\n"+c}

Source:

point = function(pointerLocation, string) {
    spaces = "";
    for(i=0; i < pointerLocation; i++) {
        spaces += " ";
    };
    return string + "\n" + spaces +"^";
}

JavaScript (ES6): 63 62 56 52 bytes

point=(a,b)=>{return b+"\n"+Array(a).join(" ")+" ^"}

Version that works across all browsers (58 bytes):

point=function(a,b){return b+"\n"+Array(a).join(" ")+" ^"}
3 Strikethrough
source | link

JavaScript (ES6): 6263 62 56 bytes

point=(a,b)=>{c="";forc=Array(i=0;i<a;i++a)c+=".join(" ";return")+" b+"\n"+c+"^"^";return b+"\n"+c}

Version that works across all browsers (6862 bytes):

point=function(a,b){c="";forc=Array(i=0;i<a;i++a)c+=".join(" ";return")+" b+"\n"+c+"^"^";return b+"\n"+c}

Source:

point = function(pointerLocation, string) {
    spaces = "";
    for(i=0; i < pointerLocation; i++) {
        spaces += " ";
    };
    return string + "\n" + spaces +"^";
}

JavaScript (ES6): 62 bytes

point=(a,b)=>{c="";for(i=0;i<a;i++)c+=" ";return b+"\n"+c+"^"}

Version that works across all browsers (68 bytes):

point=function(a,b){c="";for(i=0;i<a;i++)c+=" ";return b+"\n"+c+"^"}

Source:

point = function(pointerLocation, string) {
    spaces = "";
    for(i=0; i < pointerLocation; i++) {
        spaces += " ";
    };
    return string + "\n" + spaces +"^";
}

JavaScript (ES6): 63 62 56 bytes

point=(a,b)=>{c=Array(a).join(" ")+" ^";return b+"\n"+c}

Version that works across all browsers (62 bytes):

point=function(a,b){c=Array(a).join(" ")+" ^";return b+"\n"+c}

Source:

point = function(pointerLocation, string) {
    spaces = "";
    for(i=0; i < pointerLocation; i++) {
        spaces += " ";
    };
    return string + "\n" + spaces +"^";
}
2 Save 1 byte
source | link
1
source | link