score:1
Accepted answer
Looks like that's a quick way of throwing an exception when, in this case, said element property (elem.opacity
) is falsey.
Running the following statement throws a "runtime" error:
alert(elem.opacity ||Â 0);
Writing that is shorter than writing:
alert(elem.opacity ? elem.opacity : throw 'some error message');
Note: the throw
statement will not work as expected (writing to the console "some error message") -- as the ternary expression should return a value.
Thus, (elem.opacity ||Â 0)
suffices and keeps the code concise/terse and defensive, but not very semantic ...
In Short
The following:
... (elem.opacity ||Â 0) ...
Translates to:
Throw an error if elem.opacity
is undefined
.
Source: stackoverflow.com
Related Query
- Strange character in the Highstock source code
- use highchart and highstock on the same page
- Displaying multiple series in the navigator of an HighStock chart
- Highstock chart: navigator displays the wrong area in negative-color
- Show gridLines when the chart is empty(no series) in highstock
- How to extract the data from highstock chart
- How to hide series via the legend in highstock ?
- Move the Highstock navigator position
- How can I get the navigator selection from a Highstock chart?
- Get the currently selected range from RangeSelector in Highstock
- Getting the complete XML source out of an XML DOM object
- How do I prevent Highstock right range handle keep slipping off the max value when adding data
- Highmaps: what is the code for a county?
- c# WPF Webbrowser with Highchart, Javascript from external source not working "An error has occurred in the script on this page"
- Is there a way to load data into Highstock without the use of PHP?
- how to display 2 same highcharts without duplicate the code
- How to show plotlines on highstock when its set much higher than the data series?
- Does this qualify for the Highstock NON-COMMERCIAL LICENSE?
- Display HighStock y-axis and its labels on the right of the series
- Is it possible to have two Y Axis in a highstock chart from highcharts one on the left and another on the right?
- Highstock navigator step like the parent chart
- Highstock double yAxis - can the legend be split?
- Highstock How to remove the cross icon in Range selector text box in IE
- How to change the theme of a Highstock graph with a button?
- Highstock - How can i display the open, high, low, close in the line or area charts tooltip
- Highstock stacked bar chart with slider overlayed on the graph
- HighStock doesn't work with gapsize the same way
- Highstock updating of the chart each second
- Highcharts (Gauge) and Highstock on the same page with Meteor
- Is there a way of dynamically toggling the Highstock navigator to regain vertical space for the chart?
More Query from same tag
- Convert data to percentages HighCharts
- Dynamically generating HighCharts with SQL Server database
- HighCharts series Z index
- How to show popup on highchart column click
- Add data dynamicly with highcharts using reactjs
- after using for loop all my column graphs are plotted in single color i need each bar in different color in highcharts
- Highcharts stacked percentage area
- Highmaps occuring 'Uncaught TypeError: undefined is not a function ' and not loading?
- how to add comma between the digit (as a label )
- Spline graph + column chart combo issue
- Highstock compare previous data point when date does not exist in series
- Solve highmaps-highcharts conflict when creating map, column and radar charts
- Highcharts, on column or x-axis category click append job number to page url
- Display 12 months on Highcharts xAxis
- chart not updating after changing the chart options
- Scientific notation to decimal notation not working in highcharts
- YAxis labels and series color the same
- Snap the mouse to the X and Y axes
- I want show NO DATA AVAILABLE with backside grid lines in highcharts
- Need help on viewing Chart values
- How to make Highstock rangeselector buttons load new data?
- Highcharts - set maximum range for yAxis but keep axis dynamic within that range
- Highlight a line with different color in Parallel coordinate chart with Highcharts
- Highcharts: Delete legend displayed only on chart and keep bottom legend
- How can I apply a radial gradient for 3d but ONLY for particular charts?
- Highcharts: setting stroke-width on a line series when styledMode is on has no effect
- Only one function in highcharts will function
- csvURL: Some of my series names say "undefined"
- Angular 5 is not rendering the component until click or hover anywhere
- Highcharts-NG, change language