如何在javascript中使用严格模式发送控制字符? [英] How to send control char using strict mode in javascript?

查看:45
本文介绍了如何在javascript中使用严格模式发送控制字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

"use strict";
var debug = function( m ) { 
    console.log('   \033[32mdebug -\033[39m:' + m ); 
}

\ 033不会以任何方式使用严格模式除了取消严格模式之外?

The \033 is not going to fly with the strict mode any way around that beside taking off the strict mode?

推荐答案

使用 \\\ 代替。 \0 ... 是一个八进制转义序列,您的JavaScript环境可能不支持。

Use \u001b instead. \0... is an octal escape sequence which your JavaScript environment might not support.

这篇关于如何在javascript中使用严格模式发送控制字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆