const arr = ['a', 'b', 'c'];
// arr.forEach(function (elem, idx) {
// console.log('index = ' + idx + ', element = ' + elem);
// });
for (const [idx, elem] of err.entries()) {
console.log(`index = ${idx}, element = ${elem}`);
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // http://stackoverflow.com/a/16484266/754377 | |
| function DataBind(element, data) { | |
| this.data = data; | |
| this.element = element; | |
| element.value = data; | |
| element.addEventListener("change", this, false); | |
| } | |
| DataBind.prototype.handleEvent = function(event) { | |
| switch (event.type) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| a[href^="http://"]:not([href*="YOUR_DOMAIN.com"])::after { | |
| font-family: FontAwesome; | |
| content: "\f08e"; | |
| display: inline-block; | |
| vertical-align: middle; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @ngdoc module | |
| * @name Restful | |
| * @description | |
| * | |
| * Restful is a base class from which to extend and create more CRUD services | |
| * without the need to repeat the same CRUD operations and implementation | |
| * with each additional service. | |
| * | |
| * The Restful factory takes one argument, a configuration object. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * SVG Fixer | |
| * | |
| * Fixes references to inline SVG elements when the <base> tag is in use. | |
| * Firefox won't display SVG icons referenced with | |
| * `<svg><use xlink:href="#id-of-icon-def"></use></svg>` when the <base> tag is on the page. | |
| * | |
| * More info: | |
| * - http://stackoverflow.com/a/18265336/796152 | |
| * - http://www.w3.org/TR/SVG/linking.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // The bitwise NOT (~) operator inverts the -1 to 0, and the !! operator coerces that value to false when the string is not in the array. | |
| var arr = ['foo', 'bar']; | |
| var str = 'baz'; | |
| var isTrue = !!~arr.indexOf(str); // return false | |
| str = 'foo'; | |
| isTrue = !!~arr.indexOf(str); // return true | |
| // Which is essentially a one-liner for this: | |
| var isTrue = true; | |
| if (arr.indexOf(str) === -1) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [lang="ja"] body{ | |
| font-family:"ヒラギノ角ゴ Pro","Hiragino Kaku Gothic Pro","メイリオ",Meiryo,Osaka,"MS Pゴシック","MS PGothic","MS Gothic”, | |
| "MS ゴシック","Helvetica Neue”,Helvetica,Arial, | |
| sans-serif !important | |
| } | |
| [lang="ko"] body{ | |
| font-family:"나눔 고딕","Nanum Gothic","맑은 고딕","Malgun Gothic”, | |
| "Apple Gothic","돋움",Dotum,"Helvetica Neue”,Helvetica, | |
| Arial,sans-serif !important | |
| } |
在陣列最後加入新的元素:
var arr = [1, 2, 3, 4, 5];
arr[arr.length] = 6;效能較 arr.push(6) 好。
<span class="tooltip-toggle" data-tooltip="Sample text for your tooltip!">
Label for your tooltip
</span>.tooltip-toggle {
cursor: pointer;
position: relative;