string2 [Javascript][Regex] Regex test does not select all items from a list [javascript] RegEx g flag test flag: g >> remember lastIndex /c/ig.test('ccc') // true /c/ig.test('ccc') // false // vs /c/i.test('ccc') // true /c/i.test('ccc') // true Don’t use g if you want to test several times Or Before another test, you should make test return false 시나리오 Senario I want to get all items that contains my search words. I used Regex test to fil.. 2022. 8. 22. [javascript] how to parse string to number, Number, parseInt, + Number() converts the type whereas parseInt parses the value of input. Number('123'); parseInt('123', 10); +'123'; Parseing string with non-digit character Number('123 asf'); // NaN parseInt('123 asf'); // 123 As you see, parseInt will parse up to the first non-digit character. On the other hand, Number will try to convert the entire string. binary, decimal parseInt('0101'); // 101 parseInt('010.. 2022. 7. 12. 이전 1 다음