js octal number All In One
js octal number All In One
const user = {
name: "Hayes",
id: 0,
};
interface User {
name: string;
id: number;
};
const user1: User = {
name: "Eric",
id: 0o7,
// id: 007,
};
/*
Octal literals are not allowed in strict mode.ts(1121)
Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o7'.ts(1085)
*/
const user2: User = {
name: "Eric",
id: '007',
};
/*
Type 'string' is not assignable to type 'number'.ts(2322)
defined-types.ts(9, 3): The expected type comes from property 'id' which is declared here on type 'User'
*/
Octal number (0o)
// ES-old
var n = 0755;
// 493
var m = 0644;
// 420
// ES2015 / ES6
var a = 0o10;
// 8
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Numbers_and_dates#octal_numbers
Hexadecimal number (0X / 0x)
0xFFFFFFFFFFFFFFFFF // 295147905179352830000
0x123456789ABCDEF // 81985529216486900
0XA // 10
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Numbers_and_dates#hexadecimal_numbers
refs
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Numbers_and_dates
http://www.javascripter.net/faq/octalsan.htm
©xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/14928206.html
未经授权禁止转载,违者必究!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
2020-06-24 Cloud Linux CLI & dart pub All In One
2020-06-24 free online linux terminal & github cli online
2019-06-24 css & auto height & overflow: hidden;
2019-06-24 Flutter web & Flutter
2019-06-24 webpack 4 & dev server
2018-06-24 HTML Imports
2018-06-24 ES6 Tutorial & ES-next Tutorial