node.js - Node.js 是否支持 String.MatchAll 方法?
问题描述
当我测试代码时:
let result = 'heymama'.matchAll(/m(a)/g);
我收到错误“ 'heymama'.matchAll 不是函数”
当我运行版本时:
let result = 'heymama'.match(/ma/g);
没有错误。
解决方案
matchAll
从 v12.0.0 开始在 Node.js 中可用
推荐阅读
- html - MS Edge 中出现和消失的 CSS 边框
- java - 用于生成给定 JSON 字符串的 Java 类
- c++ - getline() 取行结束和下一行开始
- java - 在 Android 上使用椭圆曲线密钥对
- c# - 如何使用 asp.net 和 C# 从 SQL Server 检索数据并显示为任务计划程序?
- python - 熊猫在一个图中比较每小时的多年数据
- java - 查找后使用 RandomAccessFile 的 JAVA 非常慢。是什么原因?
- .net - 跨多个线程管理状态
- c# - C# 并发应用程序 - 唯一自定义生成的 Id
- macros - 在 emacs lisp 中定义 let 宏范围