【笔记】js生成随机字母

来源:互联网 发布:算法之美 编辑:程序博客网 时间:2024/05/29 03:21

在写黑客帝国文字特效的时候,字母是随机出现生成的

使用String.fromCharCode()即可转换unicode为字母

这是W3Cschool给的例子


<script type="text/javascript">document.write(String.fromCharCode(72,69,76,76,79))document.write("<br />")document.write(String.fromCharCode(65,66,67))</script>
使用Math随机产生数字,65-90||97-122
使用String.fromCharCode()就可以随机生成A-Z||a-z的字母了
0 0
原创粉丝点击