<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [com-tools](./com-tools.md) &gt; [betterEval](./com-tools.bettereval.md)

## betterEval() function

由于 eval() 有 安全 和 性能 的问题，所以封装了本函数 来 替代 eval() 本方法采用 Function 的方式 来实现 eval() 的效果；

**Signature:**

```typescript
export declare function betterEval(code: string): any;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

code


</td><td>

string


</td><td>


</td></tr>
</tbody></table>
**Returns:**

any

