What does question mark equals mean in CoffeeScript?

Alexander

In this line of code of an Backbone app:

window.App ?= {}

what does ?= mean? Is is something like initialization of a Backbone app with empty defaults?

I'm new to Backbone/CoffeeScript and I read that an empty app (in CoffeeScript) would look like:

window.MyApp =
  Models: {}
  Collections: {}
  Views: {}
  Routers: {}
  initialize: -> 
    #do stuff

So is the first a shorthand for the second?

nikoshr

It is the existential operator in CoffeeScript and would be (almost) equivalent to this JS

window.App = window.App || {};

It ensures that your App namespace is defined.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

What does question mark mean?

From Dev

What does this question mark mean in Flow: "?() => void"

From Dev

What does the question mark in "Decimal?" mean?

From Dev

XML what does that question mark mean

From Dev

What does the triple question mark mean in scala?

From Dev

What does the question mark in java mean?

From Dev

What does .php question mark = mean?

From Dev

What does the question mark in terminal command mean?

From Dev

What does the "?" (question mark) mean in javascript?

From Dev

What does this two question mark mean?

From Dev

What does the question mark in terminal command mean?

From Dev

What does hypothesis with operator with question mark mean

From Dev

What does this mean in Coffeescript?

From Java

What does double question mark (??) operator mean in PHP

From Java

What does question mark and dot operator ?. mean in C# 6.0?

From Dev

What does "type" mean and is there is a special use for a question mark in ECMA 6?

From Dev

What does the question mark in member access mean in C#?

From Dev

What does the question mark mean in a type parameter bound?

From Dev

What does the question mark icon by a file name mean in Aptana?

From Dev

What does %-mark mean in Clojure?

From Dev

What do a question mark (?) and an ampersand (&) mean in a URL?

From Dev

What does a question mark after the file name mean using ls terminal command?

From Java

What does an exclamation mark mean in the Swift language?

From Dev

What does the exclamation mark mean for a swift initializer?

From Dev

What does this exclamation mark mean in Javascript?

From Dev

What does an exclamation mark mean in diff output?

From Dev

What does the exclamation mark mean in udev rule?

From Dev

What does the percent mean with an equals and not a like?

From Dev

What does => (equals greater than) mean in Fortran?

Related Related

  1. 1

    What does question mark mean?

  2. 2

    What does this question mark mean in Flow: "?() => void"

  3. 3

    What does the question mark in "Decimal?" mean?

  4. 4

    XML what does that question mark mean

  5. 5

    What does the triple question mark mean in scala?

  6. 6

    What does the question mark in java mean?

  7. 7

    What does .php question mark = mean?

  8. 8

    What does the question mark in terminal command mean?

  9. 9

    What does the "?" (question mark) mean in javascript?

  10. 10

    What does this two question mark mean?

  11. 11

    What does the question mark in terminal command mean?

  12. 12

    What does hypothesis with operator with question mark mean

  13. 13

    What does this mean in Coffeescript?

  14. 14

    What does double question mark (??) operator mean in PHP

  15. 15

    What does question mark and dot operator ?. mean in C# 6.0?

  16. 16

    What does "type" mean and is there is a special use for a question mark in ECMA 6?

  17. 17

    What does the question mark in member access mean in C#?

  18. 18

    What does the question mark mean in a type parameter bound?

  19. 19

    What does the question mark icon by a file name mean in Aptana?

  20. 20

    What does %-mark mean in Clojure?

  21. 21

    What do a question mark (?) and an ampersand (&) mean in a URL?

  22. 22

    What does a question mark after the file name mean using ls terminal command?

  23. 23

    What does an exclamation mark mean in the Swift language?

  24. 24

    What does the exclamation mark mean for a swift initializer?

  25. 25

    What does this exclamation mark mean in Javascript?

  26. 26

    What does an exclamation mark mean in diff output?

  27. 27

    What does the exclamation mark mean in udev rule?

  28. 28

    What does the percent mean with an equals and not a like?

  29. 29

    What does => (equals greater than) mean in Fortran?

HotTag

Archive