Closed Bug 1373778 Opened 7 years ago Closed 7 years ago

Javascript Documentation - Switch syntax

Categories

(Developer Documentation Graveyard :: JavaScript, enhancement)

All
Other
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ceciliamarnero, Unassigned)

Details

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

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
(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
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.