What is the difference between an expression?

What is the difference between an expression?

In JavaScript we have expression and statement. Even though I read the definition about it multiple times, after a while, I still forget which one is which.

In JavaScript we have expression and statement. Even though I read the definition about it multiple times, after a while, I still forget which one is which. So, this post is a reminder for everyone like me who confuses these two, so you will never forget it but always keep in mind the difference between expression and statement.

Image for post

A JS expression is any valid code that resolves into a value and can be written whenever you would expect a value. Usually expression are written in only one line. For example:

  • 42 // a number
  • “Hello World” // a string
  • 42 + 1 // a calculation
  • x = 42 + 1 // calculation
  • myVar // a variable
  • myFun() // a function that returns a value

But it’s more complicated than you think . There are different types of expressions:

  • Arithmetic: Resolves to a number, e.g.

42

42 + 1

etc.

  • String: Resolves to a string, e.g.

"Hello World"

"123"

etc.

  • Logical: Resolves to true or false and often uses a logical operator, e.g.

coding programming software-development web-development javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Offshore Software Development - Best Practices

To make the most out of the benefits of offshore software development, you should understand the crucial factors that affect offshore development.

Software Developer vs Web Developer | Difference Web Developer & Software Developer

Software Developer vs Web Developer | Difference Web Developer & Software Developer | Software development and web development are normally used interchangeably. Although both include development, a software developer has different responsibilities from that of a web developer.

ERP Software Services, POS Software Services , Application Development

Vinew Technologies focused majorly over ERP Software services and POS Software services, Web & Application development services & Woo commerce and Wordpress easy-to-use, multipurpose social media plugin for WordPress.

5 Core Criteria for Selecting Software Development Company - TopDevelopers.co

Check out these five criteria for the selection of your software vendor, and you will never regret having the wrong quality product made for you.

Best Software Development Company in Melbourne

Software Development Company in Sydney, Melbourne. Vrinsoft is Australia based Software Development Agency provides software solutions to increase your sales, reduce costs, and automates business processes with cost-effective, high-quality software development services.