Tutorial by Examples

It's an emulation of classical inheritance using prototypical inheritance which shows how powerful prototypes are. It was made to make the language more attractive to programmers coming from other languages. 6 IMPORTANT NOTE: Since ES6 it doesn't make sense to use pseudo-calssical inheritance sinc...
After the user has approved a request for permission to send notifications, we can send a simple notification that says Hello to the user: new Notification('Hello', { body: 'Hello, world!', icon: 'url to an .ico image' }); This will send a notification like this: Hello Hello, world!
5 It allows us to define a property in an existing object using a property descriptor. var obj = { }; Object.defineProperty(obj, 'foo', { value: 'foo' }); console.log(obj.foo); Console output foo Object.defineProperty can be called with the following options: Object.definePropert...
5 Using property descriptors we can make a property read only, and any attempt to change it's value will fail silently, the value will not be changed and no error will be thrown. The writable property in a property descriptor indicates whether that property can be changed or not. var a = { }; ...
5 We can avoid a property from showing up in for (... in ...) loops The enumerable property of the property descriptor tells whether that property will be enumerated while looping through the object's properties. var obj = { }; Object.defineProperty(obj, "foo", { value: 'show', enu...
5 A property's descriptor can be locked so no changes can be made to it. It will still be possible to use the property normally, assigning and retrieving the value from it, but any attempt to redefine it will throw an exception. The configurable property of the property descriptor is used to dis...
5 Treat a property as a combination of two functions, one to get the value from it, and another one to set the value in it. The get property of the property descriptor is a function that will be called to retrieve the value from the property. The set property is also a function, it will be call...
Syntax: SELECT * FROM table_name Using the asterisk operator * serves as a shortcut for selecting all the columns in the table. All rows will also be selected because this SELECT statement does not have a WHERE clause, to specify any filtering criteria. This would also work the same way if you...
This query will return the number of tables in the specified database. USE YourDatabaseName SELECT COUNT(*) from INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' Following is another way this can be done for all user tables with SQL Server 2008+. The reference is here. SELECT COUNT(...
The following queries will return a list of all Stored Procedures in the database, with basic information about each Stored Procedure: SQL Server 2005 SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_TYPE = 'PROCEDURE' The ROUTINE_NAME, ROUTINE_SCHEMA and ROUTINE_DEFINITION columns are...
In this type of image addition, the image URL is included at the location where the image will be displayed. If you need to add the same image several times, you must include its URL every time. Markdown Source Picture of Duck: ![Duck](http://i.stack.imgur.com/ukC2U.jpg) HTML Output Pictu...
Note that these only work in the developer tools of certain browsers. $_ gives you the value of whatever expression was evaluated last. "foo" // "foo" $_ // "foo" $0 refers to the DOM element currently selected in the Inspector. So if &l...
In this type of image addition, one image can be used several times without duplicating its URL, making it a good choice when using one image multiple times in a document. Markdown Source Picture of Duck: ![Duck][1] Same picture of Duck: ![Same Duck][1] [1]: http://i.stack.imgur.com/uk...
While object property notation is usually written as myObject.property, this will only allow characters that are normally found in JavaScript variable names, which is mainly letters, numbers and underscore (_). If you need special characters, such as space, ☺, or user-provided content, this is poss...
Sometimes the property name needs to be stored into a variable. In this example, we ask the user what word needs to be looked up, and then provide the result from an object I've named dictionary. var dictionary = { lettuce: 'a veggie', banana: 'a fruit', tomato: 'it depends on who yo...
Disclaimer: Creating array-like objects is not recommend. However, it is helpful to understand how they work, especially when working with DOM. This will explain why regular array operations don't work on DOM objects returned from many DOM document functions. (i.e. querySelectorAll, form.elements)...
To find a character or another string, you can use std::string::find. It returns the position of the first character of the first match. If no matches were found, the function returns std::string::npos std::string str = "Curiosity killed the cat"; auto it = str.find("cat"); ...
The function std::find, defined in the <algorithm> header, can be used to find an element in a std::vector. std::find uses the operator== to compare elements for equality. It returns an iterator to the first element in the range that compares equal to the value. If the element in question is...
An array can easily be converted into a std::vector by using std::begin and std::end: C++11 int values[5] = { 1, 2, 3, 4, 5 }; // source array std::vector<int> v(std::begin(values), std::end(values)); // copy array to new vector for(auto &x: v) std::cout << x << &q...
When you start a thread, it will execute until it is finished. Often, at some point, you need to (possibly - the thread may already be done) wait for the thread to finish, because you want to use the result for example. int n; std::thread thread{ calculateSomething, std::ref(n) }; //Doing some...

Page 86 of 1336