本文介绍了如何在 JavaScript 中模拟宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道 JavaScript 不支持宏(Lisp 风格的),但我想知道是否有人有解决方案来模拟宏?我用谷歌搜索了一下,其中一种解决方案建议使用 eval()
,但正如他所说,成本会很高.
I know that JavaScript doesn't support macros (Lisp-style ones) but I was wondering if anyone had a solution to maybe simulate macros? I Googled it, and one of the solutions suggested using eval()
, but as he said, would be quite costly.
他们真的不必很花哨.我只想和他们做一些简单的事情.而且它不应该使调试变得更加困难:)
They don't really have to be very fancy. I just want to do simple stuff with them. And it shouldn't make debugging significantly harder :)
推荐答案
你可以使用 parenscript.这将为您提供 Javascript 的宏.
You could use parenscript. That'll give you macros for Javascript.
这篇关于如何在 JavaScript 中模拟宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!