Home declaring a variable with colon in JavaScript
Reply: 0

declaring a variable with colon in JavaScript

user546 Published in March 20, 2018, 5:36 am

Hi right now i'm learning JavaScript. There is a confusion with some JavaScript I just found. This is the source code

import type { OptionsType } from 'Types'

const theme: OptionsType = {
  title: 'Lawton',
  baseFontSize: '16px',
  baseLineHeight: 1.5

In the code, the const variable is declared with ":"

What does ":" mean in the expression ?

Is it equivalent with

const theme = OptionsType = { title: 'Lawton' }
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.316334 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO