bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

Javascript Documentation - Switch syntax

RESOLVED FIXED

Status

Developer Documentation
JavaScript
RESOLVED FIXED
a year ago
a year ago

People

(Reporter: Cecilia Marnero, Unassigned)

Tracking

Details

(Whiteboard: [specification][type:change])

(Reporter)

Description

a year ago
What feature should be changed? Please provide the URL of the feature if possible.
==================================================================================
In the switch syntax, shouldn't Default block be beetween brackets because it's optional?


https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Control_flow_and_error_handling

What problems would this solve?
===============================
syntax would be correct

Who would use this?
===================
developers looking for fast reference

What would users see?
=====================
?

What would users do? What would happen as a result?
===================================================
¡

Is there anything else we should know?
======================================
this is a very complicated form :/
actually, "case" is also optional, and the following is valid:
  switch (1) {}

I'm not sure adding so many brackets to the syntax example is readable.
might be better enumerating some usual cases?
Component: Editing → JavaScript
Product: Mozilla Developer Network → Developer Documentation
(Reporter)

Comment 2

a year ago
(In reply to Tooru Fujisawa [:arai] from comment #1)
> actually, "case" is also optional, and the following is valid:
>   switch (1) {}
> 
> I'm not sure adding so many brackets to the syntax example is readable.
> might be better enumerating some usual cases?

True, to stick so much to the all possible uses and using so many brackets it is confusing, but not using "default" is more common than not using "case" I think, which would be actually a weird use of a switch statement.
I've left case alone, but have added brackets around the default clause. I've also added the default clause to the list of terms below the syntax box itself.
Status: UNCONFIRMED → RESOLVED
Last Resolved: a year ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.