본문 바로가기

JavaScript47

[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.
Dom id => window[id] or document.querySelector('#id') Why don't we just use element IDs as identifiers in JavaScript? HTML 5 spec, 'Named access on window object" window[name] Returns the indicated element or collection of elements. As a general rule, relying on this will lead to brittle code. Which IDs end up mapping to this API can vary over time, as new features are added to the web platform, for example. Instead of this, use document.getElement.. 2022. 7. 22.
the-dom-challenge: Build something with only vanilla Javascript [The Dom Challenge]https://github.com/devkodeio/the-dom-challenge 2022. 7. 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.
[javascript] IIFE(immediately invoked function expression) Search: javascript parentheses IIFE tmp=function(){}() +function(){}() -function(){}() 0/function(){}() 0*function(){}() 0?0:function(){}() (function(){}()) (function(){})() Why are parentheses required around JavaScript IIFE? [duplicate]Ask Question There are two ways to create functions in JavaScript (well, 3, but let's ignore new Function()). You can either write a function declaration or.. 2022. 7. 12.
[CSS] Disabling text selection => user-select property How do I prevent the browser (JavaScript and CSS) from disabling text selection on web pages without disabling all JavaScript?Ask Question Search: javascript css how to prevent content selected div.disable { user-select: none; } [css] disabling text selection 2022. 7. 10.
MouseEvent: key, metaKey, ctrlKey [javascript] key, metaKey, ctrlKey Ctrl key key: “Control” code: "ControllLeft" ctrlKey: true metaKey: false Mac Command key 2022. 7. 8.
[axios] onUploadProgress - progress bar Search: axios request how to set progress bar Dom 80% : The Progress Indicator element - HTML: HyperText Markup Language | MDN handle progress bar // handle progress bar function function handleUploadProgressBar(progress) { document.querySelector('#file').value = progress; document.querySelector('#file').innerHTML = progress; } // request axios.put('/update', formData, { headers: { "Content-Type.. 2022. 7. 7.
[chrome][devtools] elements tab right click not working Search: elements tab right click not working Move to elements tab on chrome "Developer Tools". If you try Zoom in/out with devtools active, right click will work at some point lol Answer: Just [Zoom out / Zoom in] in inspect element window until it work [use Ctrl + + / Ctrl + -]I know it's a crazy thing! but i tried alot and alot and i found that Cannot right click on an element from Dev Too.. 2022. 7. 7.
[vue] vuex: dispatch actions btw vuex modules? namespace? Is there a way to dispatch actions between two namespaced vuex modules? Search: vuex dispatch action from another module You just need to specify that you're dispatching from the root context: // from the gameboard.js vuex module dispatch('notification/triggerSelfDismissingNotifcation', {...}, {root:true}) Now when the dispatch reaches the root it will have the correct namespace path.. 2022. 7. 6.