Skip to main content

You can use the logical 'OR' operator in place of the Elvis operator:

For example displayname = user.name || "Anonymous" .

But Javascript currently doesn't have the other functionality. I'd recommend looking at CoffeeScript if you want an alternative syntax. It has some shorthand that is similar to what you are looking for.

For example The Existential Operator

zip = lottery.drawWinner?().address?.zipcode

Function shortcuts

()->  // equivalent to function(){}

Sexy function calling

func 'arg1','arg2' // equivalent to func('arg1','arg2')

There is also multiline comments and classes. Obviously you have to compile this to javascript or insert into the page as <script type='text/coffeescript>' but it adds a lot of functionality :) . Using <script type='text/coffeescript'> is really only intended for development and not production.

You can use the logical operator in place of the Elvis operator

For example displayname = user.name || "Anonymous" .

But Javascript currently doesn't have the other functionality. I'd recommend looking at CoffeeScript if you want an alternative syntax. It has some shorthand that is similar to what you are looking for.

For example The Existential Operator

zip = lottery.drawWinner?().address?.zipcode

Function shortcuts

()->  // equivalent to function(){}

Sexy function calling

func 'arg1','arg2' // equivalent to func('arg1','arg2')

There is also multiline comments and classes. Obviously you have to compile this to javascript or insert into the page as <script type='text/coffeescript>' but it adds a lot of functionality :) . Using <script type='text/coffeescript'> is really only intended for development and not production.

You can use the logical 'OR' operator in place of the Elvis operator:

For example displayname = user.name || "Anonymous" .

But Javascript currently doesn't have the other functionality. I'd recommend looking at CoffeeScript if you want an alternative syntax. It has some shorthand that is similar to what you are looking for.

For example The Existential Operator

zip = lottery.drawWinner?().address?.zipcode

Function shortcuts

()->  // equivalent to function(){}

Sexy function calling

func 'arg1','arg2' // equivalent to func('arg1','arg2')

There is also multiline comments and classes. Obviously you have to compile this to javascript or insert into the page as <script type='text/coffeescript>' but it adds a lot of functionality :) . Using <script type='text/coffeescript'> is really only intended for development and not production.

Another very minor fix.
Source Link
Elias Zamaria
  • 99.7k
  • 33
  • 119
  • 149

You can use the logical operator in place of the Elvis operator

For example displayname = user.name || "Anonymous" .

But Javascript currently doesn't have the other functionality. I'd recommend looking at CofeescriptCoffeeScript if you want an alternative syntax. It has some shorthand that areis similar to what you are looking for.

For example The Existential Operator

zip = lottery.drawWinner?().address?.zipcode

Function shorcutsshortcuts

()->  // equivalent to function(){}

Sexy function calling

func 'arg1','arg2' // equivalent to func('arg1','arg 2''arg2')

There is also multiline comments and classes. Obviously you have to compile this to javascript or insert into the page as <script type='coffeetype='text/script>'coffeescript>' but it adds a lot of functionality :) . Using <script type='coffeetype='text/script'>coffeescript'> is really only intended for development and not production.

You can use the logical operator in place of the Elvis operator

For example displayname = user.name || "Anonymous" .

But Javascript currently doesn't have the other functionality. I'd recommend looking at Cofeescript if you want an alternative syntax. It has some shorthand that are similar to what you are looking for.

For example The Existential Operator

zip = lottery.drawWinner?().address?.zipcode

Function shorcuts

()->  // equivalent to function(){}

Sexy function calling

func 'arg1','arg2' // equivalent to func('arg1','arg 2')

There is also multiline comments and classes. Obviously you have to compile this to javascript or insert into the page as <script type='coffee/script>' but it adds a lot of functionality :) . Using <script type='coffee/script'> is really only intended for development and not production.

You can use the logical operator in place of the Elvis operator

For example displayname = user.name || "Anonymous" .

But Javascript currently doesn't have the other functionality. I'd recommend looking at CoffeeScript if you want an alternative syntax. It has some shorthand that is similar to what you are looking for.

For example The Existential Operator

zip = lottery.drawWinner?().address?.zipcode

Function shortcuts

()->  // equivalent to function(){}

Sexy function calling

func 'arg1','arg2' // equivalent to func('arg1','arg2')

There is also multiline comments and classes. Obviously you have to compile this to javascript or insert into the page as <script type='text/coffeescript>' but it adds a lot of functionality :) . Using <script type='text/coffeescript'> is really only intended for development and not production.

added 1 character in body
Source Link
Lime
  • 13.5k
  • 11
  • 57
  • 90

You can use the logical operator in place of the Elvis operator

For example displayname = user.name || "Anonymous" .

But Javascript currently doesn't have the other functionality. I'd recommend looking at Cofeescript if you want an alternative syntax. It has some shorthand that are similar to what you are looking for.

For example The Existential Operator

zip = lottery.drawWinner?().address?.zipcode

Function shorcuts

()->  // equivalent to function(){}

Sexy function calling

func 'arg1','arg2' // equivalent to func('arg1','arg 2')

There is also multiline comments and classes. Obviously you have to compile this to javascript or insert into the page as <script type='coffee/script>' but it adds a lot of functionality :) . Using <script type='cofeetype='coffee/script'> is really only intended for development and not production.

You can use the logical operator in place of the Elvis operator

For example displayname = user.name || "Anonymous" .

But Javascript currently doesn't have the other functionality. I'd recommend looking at Cofeescript if you want an alternative syntax. It has some shorthand that are similar to what you are looking for.

For example The Existential Operator

zip = lottery.drawWinner?().address?.zipcode

Function shorcuts

()->  // equivalent to function(){}

Sexy function calling

func 'arg1','arg2' // equivalent to func('arg1','arg 2')

There is also multiline comments and classes. Obviously you have to compile this to javascript or insert into the page as <script type='coffee/script>' but it adds a lot of functionality :) . Using <script type='cofee/script'> is really only intended for development and not production.

You can use the logical operator in place of the Elvis operator

For example displayname = user.name || "Anonymous" .

But Javascript currently doesn't have the other functionality. I'd recommend looking at Cofeescript if you want an alternative syntax. It has some shorthand that are similar to what you are looking for.

For example The Existential Operator

zip = lottery.drawWinner?().address?.zipcode

Function shorcuts

()->  // equivalent to function(){}

Sexy function calling

func 'arg1','arg2' // equivalent to func('arg1','arg 2')

There is also multiline comments and classes. Obviously you have to compile this to javascript or insert into the page as <script type='coffee/script>' but it adds a lot of functionality :) . Using <script type='coffee/script'> is really only intended for development and not production.

added 167 characters in body
Source Link
Lime
  • 13.5k
  • 11
  • 57
  • 90
Loading
added 150 characters in body
Source Link
Lime
  • 13.5k
  • 11
  • 57
  • 90
Loading
Source Link
Lime
  • 13.5k
  • 11
  • 57
  • 90
Loading