有一种方法可以访问x()范围内的阴影变量a的值
function x () {
a = 1;
function foo() {
a = 2;
console.log(a);
}
foo();
};
x();
console.log(window.a);
答案 0 :(得分:0)
阅读You Don't Know JS的“范围和闭包”部分,其解释清楚
尝试一下:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-113-b763d83160d2> in <module>
32 ),
33 row = rownum,
---> 34 col = colnum,
35 # marker_size = 5)
36 )
~\Anaconda3\lib\site-packages\plotly\basedatatypes.py in add_trace(self, trace, row, col, secondary_y)
1648 rows=[row] if row is not None else None,
1649 cols=[col] if col is not None else None,
-> 1650 secondary_ys=[secondary_y] if secondary_y is not None else None,
1651 )
1652
~\Anaconda3\lib\site-packages\plotly\basedatatypes.py in add_traces(self, data, rows, cols, secondary_ys)
1719 # Validate rows / cols
1720 n = len(data)
-> 1721 BaseFigure._validate_rows_cols("rows", n, rows)
1722 BaseFigure._validate_rows_cols("cols", n, cols)
1723
~\Anaconda3\lib\site-packages\plotly\basedatatypes.py in _validate_rows_cols(name, n, vals)
1562
1563 if [r for r in vals if not isinstance(r, int)]:
-> 1564 BaseFigure._raise_invalid_rows_cols(name=name, n=n, invalid=vals)
1565 else:
1566 BaseFigure._raise_invalid_rows_cols(name=name, n=n, invalid=vals)
~\Anaconda3\lib\site-packages\plotly\basedatatypes.py in _raise_invalid_rows_cols(name, n, invalid)
1551 )
1552
-> 1553 raise ValueError(rows_err_msg)
1554
1555 @staticmethod
ValueError:
If specified, the rows parameter must be a list or tuple of integers
of length 1 (The number of traces being added)
Received: [2]