Skip to main content

JavaScript Short Notes

JavaScript Short Notes




JavaScript Arrays Destructuring

Assigning array items to variable

const [a, b, c] = [123, 'second', true];

//a => 123
//b => 'second'
//c => true


Skipping items

const [, b] = [123, 'second', true];
//b => 'second'


Assigning the first value, storing the rest together

const [a, b, ...rest] = [123, 'second', true, false, 42];

//a => 123
//b => 'second'
//c => [true, false, 42]


Swapping variables

let x = true;
let y = false;
[x, y] = [y, x]

//x => false
//y => true


















Comments

Popular posts from this blog

Windows Key Shortcuts

List of common keyboard shortcuts that can be used with the Windows key: (Image by - Sharma Guides | Subham232330) 1. Windows Key + D: Show the Desktop 2. Windows Key + E: Open File Explorer 3. Windows Key + I: Open Settings 4. Windows Key + L: Lock the computer 5. Windows Key + R: Open the Run Dialog 6. Windows Key + S: Open the search bar 7. Windows Key + Tab: Open Task View 8. Windows Key + Ctrl + D: Create a new virtual desktop 9. Windows Key + Ctrl + Left or Right arrow: Switch between virtual desktops 10. Windows Key + M: Minimize all windows 11. Windows Key + Shift + M: Undo minimize all windows 12. Windows Key + Up Arrow: Maximize the current window 13. Windows Key + Down Arrow: Minimize the current window 14. Windows Key + Right Arrow: Snap the current window to the right 15. Windows Key + Left Arrow: Snap the current window to the left 16. Windows Key + P: Project to a second screen 17. Windows Key + Home: Minimize all but the active window 18. Windows Key + ...

Indexing in DBMS

Indexing in DBMS Indexing is used to optimize the performance of a database by minimizing the number of disk accesses required when a query is processed.  The index is a type of data structure. It is used to locate and access the data in a database table quickly. Index structure: Indexes can be created using some database columns. The first column of the database is the search key that contains a copy of the primary key or candidate key of the table. The values of the primary key are stored in sorted order so that the corresponding data can be accessed easily.  The second column of the database is the data reference. It contains a set of pointers holding the address of the disk block where the value of the particular key can be found. Indexing Methods Ordered indices The indices are usually sorted to make searching faster. The indices which are sorted are known as ordered indices. Example: Suppose we have an employee table with thousands of record and each of which is 10 byte...

Function Keys Shortcuts

Function Keys Shortcuts (F1 - F12) (Function Keys) F1 It is used to open the help window in almost all programs. Also used to enter BIOS or CMOS Some computers allow you to enter BIOS setup using different keys like F2, F10, Delete, Esc. Pressing Window + F1 will open the Microsoft Windows Help and Support Center. F2 In Microsoft Windows, it is used to rename an icon , file , or folder that the user selects. In Microsoft Excel, the F2 key allows you to edit the selected cell in the Excel sheet. In Microsoft Word, pressing Ctrl+F2 will open the print preview window and Alt+Ctrl+F2 will open the new file or document. In addition, it is also used to enter the CMOS setup. F3 It is mainly used to open a search function for many programs. At the MS-DOS or Windows command line, it gives users the option to repeat the last command entered. In Microsoft Word, if you press Shift + F3 , it allows you to change the selected text from uppercase to lowercase or a capital letter at the beginni...