Denigma Alpha-帮助开发者破解代码之谜

        开发过程中大家是不是都遇到过这样的场景:上一个开发者没有写注释!程序代码几经转手,到你这已经是不知本意?今天意外的遇到了这样一个工具,能够在一定程度上帮助我们解决这些问题,它就是Denigma Alpha。

        官网地址:https://denigma.app/(上不去时候记得科学一下)

        进入官网首页,可以直观的看到它的介绍:

理解不熟悉的编程结构

帮助开发者破解代码之谜

用通俗易懂的英语解释代码。由机器学习提供支持。

        绿色的按钮是可以在线进行尝试,并且无需进行注册。再向下进行浏览可以看到官方提供的例子 ,可以看到能够提供支持的语言是比较全面的。

        点击显示解释,可以看到官方对这段代码的解释

        从例子来看,解释的还是比较易懂和贴切,让我们自己用代码去试试,看看能否一定程度上解决我们工作的痛点。切换到尝试页面,小贴士映入眼帘

 

  • 裁剪代码以帮助 Denigma 专注于重要部分。更少的代码有时可以带来更好的解释。
  • 对误导性变量名称进行重命名或将他们替换为“foo”或“bar”。
  • 删除多余的评论。

        写了一段常用的获取浏览器Cookie的代码,交给AI进行解释

 - The code starts by declaring a variable called cookieValue.
- The code then checks if the document.cookie exists and, if it does, splits the cookies into an array of strings with ";".
- For each string in the array, it checks to see if there is a substring that matches cookieName (the name of the cookie).
- If so, it gets the value from that string and returns it.

- The first line declares a variable called cookieValue which will hold all of our cookies' values when we check them later on in this function.

- Next comes checking for whether or not document.cookie exists and splitting up any cookies found into an array with ";" as its delimiter character:

- var cookies = document.cookie.split(';');

- for (var i = 0; i < cookies.length; i++) {

-  var cookie = cookies[i];

- if (cookie == 'name=value') { //This means that we have found a match! }
- else { break; }

- The code is used to get the value of a cookie.

        从结果来看,确实是通俗易懂了,尤其是最后一句“The code is used to get the value of a cookie.”也对这部分的代码用途下了一个定义,虽然是英文的。写到这,我发现是不是可以用这个直接生成代码注释,稍加修改,方便后来人进行阅读。

        最后,网站对隐私方面的问题进行了说明,同时,他还有VSCode的插件版本提供。

        

         这个功能推荐给大家进行使用,希望能够多多少少解决大家的一些问题。

        Tips:该写注释的地方还是要写注释的,别成为你当初厌恶的人!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Cupid_Yan

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值