提交 f05660cf 编写于 作者: lizhongyi_'s avatar lizhongyi_

调整string.charCodeAt() 示例

上级 89879312
......@@ -184,10 +184,19 @@ export function testArray(): Result {
x : number
y : number
}
// #ifndef APP-IOS
const s = JSON.parse<P[]>(JSON.stringify([{ x: 0, y: 0 }])) as P[]
s[0].x += 0;
const clearList = s.map((v : P, _, _a) : number => v.x)
expect(clearList.includes(0)).toEqual(true);e);
// #endif
// #ifdef APP-IOS
const s = JSON.parse<P[]>(JSON.stringify([{ x: 0, y: 0 }])!) as P[]
s[0].x += 0;
const clearList = s.map((v : P, index: number, _a) : number => v.x)
expect(clearList.includes(0)).toEqual(true);
// #endif
})
test("indexOf", () => {
......
......@@ -63,10 +63,10 @@ export function testString(): Result {
expect("ABC".charCodeAt(0)).toEqual(65);
expect("ABC".charCodeAt(1)).toEqual(66);
expect("ABC".charCodeAt(2)).toEqual(67);
expect("ABC".charCodeAt(3)).toEqual(null);
expect("ABC".charCodeAt(3)).toEqual(NaN);
const empty = "";
expect(empty.charCodeAt(0)).toEqual(null);
expect(empty.charCodeAt(0)).toEqual(NaN);
})
test('fromCharCode', () => {
expect(String.fromCharCode(65, 66, 67)).toEqual("ABC");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册