SyntaxError:Strict mode does not allow function declaration in a lexically nested statement.
来源:互联网 发布:启发式算法应用案例 编辑:程序博客网 时间:2024/06/05 08:34
最近在使用React Native集成环信的时候遇到了这个问题,原因是在文件头部声明了
'use strict'
但是你的项目里面还是出现了这种方法声明方式
function ts () { var d = new Date() var Hours = d.getHours() // 获取当前小时数(0-23) var Minutes = d.getMinutes() // 获取当前分钟数(0-59) var Seconds = d.getSeconds() // 获取当前秒数(0-59) return (Hours < 10 ? '0' + Hours : Hours) + ':' + (Minutes < 10 ? '0' + Minutes : Minutes) + ':' + (Seconds < 10 ? '0' + Seconds : Seconds) + ' ' }
解决方案。。。
var ts = () => { var d = new Date() var Hours = d.getHours() // 获取当前小时数(0-23) var Minutes = d.getMinutes() // 获取当前分钟数(0-59) var Seconds = d.getSeconds() // 获取当前秒数(0-59) return (Hours < 10 ? '0' + Hours : Hours) + ':' + (Minutes < 10 ? '0' + Minutes : Minutes) + ':' + (Seconds < 10 ? '0' + Seconds : Seconds) + ' ' }
踩坑指南,以上是这种情况出现的一个场景,基本上全都出现在引用包或者借鉴别人的代码里面,原因也很简单,就是版本过老,那出现问题的解决方案也有针对性了
阅读全文
0 0
- SyntaxError:Strict mode does not allow function declaration in a lexically nested statement.
- SyntaxError:Strict mode does not allow function declaration in a lexically nested statement.
- SyntaxError:Strict mode does not allow function declaration in a lexically nested statement.
- React-native运行异常之一一SyntaxError:Strict mode does not allow function declaration in a lexically nested
- rn:strict mode does not allow function declarations in a lexically nested statement
- React-Native Strict mode does not allow ...
- node.js中遇到SyntaxError: Use of const in strict mode
- node.js中遇到SyntaxError: Use of const in strict mode
- declaration may not appear after executable statement in block
- error: declaration may not appear after executable statement in block
- error: declaration may not appear after executable statement in block
- error: declaration may not appear after executable statement in block
- error: declaration may not appear after executable statement in block
- a label can only be part of a statement and a declaration is not a statement
- a label can only be part of a statement and a declaration is not a statement
- a label can only be part of a statement and a declaration is not a statement
- a label can only be part of a statement and a declaration is not a statement
- a label can only be part of a statement and a declaration is not a statement
- MyBatis学习路上打的那些码(七、ResultMap更多技巧:association、collection、constructor)
- Android Library打造自己的SDK,并Maven发布
- delphi日期时间函数
- 漫画算法:什么是跳跃表?
- Android Fragment使用(二) 嵌套Fragments (Nested Fragments) 的使用及常见错误
- SyntaxError:Strict mode does not allow function declaration in a lexically nested statement.
- Spring事务传播性与隔离级别
- HDU-4790 Just Random (数形结合)
- Android--活动
- Python画图
- 进度条
- LeetCode(40)--Combination Sum II
- 关于安卓adb配置后 还是不能用的问题
- 可以做刷新效果的两个图片飞动