DEV Community

Cover image for let var const - variables in js
Manikandan K
Manikandan K

Posted on • Edited on

5 4

let var const - variables in js

Variable

  • variables are lable that references a value.
  • variables are used to store information to be reference and manipulated in a computer program.
  • variables holds information/data.
  • storing information.
let name = 'Manikandan';
    let        -> start with  //(let, var, const)
    name       -> variable identifier
    Manikandan -> information/data
    ;          -> end of the statement

Enter fullscreen mode Exit fullscreen mode

var

  • var is function-scope.

Image description

  • Variables defined with 'var', redeclare and reassign is possible.

Image description

Image description

let

  • let is block-scope

  • Some lines of code will written in { } these parentheses, it

  • is called block-scope.

  • block-scope Variable cannot be access outside the block.

Image description

  • Variables defined with 'let', must be declare before use/assign value.
  • Once declare a Variable with 'let', after re-assign is possible but redeclare is impossible.

Image description

const

  • const is block-scope.
  • variable define with 'const', cannot be redeclare and cannot be reassign.

Image description

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series 📺

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay