Tagged Template Literals

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ต.ค. 2024

ความคิดเห็น • 7

  • @kasir-barati
    @kasir-barati 2 หลายเดือนก่อน

    Really nice feature. Thanks BTW for the real world practical hands-on + rest of the examples you've mentioned in the video.

  • @escapiststupor
    @escapiststupor 6 ปีที่แล้ว +1

    Thank you Kent for these wonderful livestreaming!

  • @sikz26300
    @sikz26300 5 ปีที่แล้ว +1

    Thanks for going over this, I'm still having trouble understanding why you'd want to go this route though. At least in the case of the translation example, I'd probably prefer doing something like:
    (user, language=language)=>{ //lang can be passed in or defaulted to browser/state or something else
    const {hello,yourBirthdayIs} = getTranslations(language);
    const {name,birthday} = user;
    return `${hello}${name}, ${yourBirthdayIs}${birthday}`
    }
    But maybe thats just this example, or maybe it just makes me feel dirty using string search to filter out my replacements.

  • @gosnooky
    @gosnooky ปีที่แล้ว

    Reduce the interpolations always (since its length is always 1 fewer than the literals)
    interpolations.reduce((acc, current, i) => acc + current + literals[i + 1], literals[0])
    More succinct this way.

  • @herrmosa918
    @herrmosa918 6 ปีที่แล้ว

    Useful tutorial

  • @julianklumpers
    @julianklumpers 6 ปีที่แล้ว +1

    What syntax theme are you using? Edit: found it already, its Nightowl.
    Nice video btw