This file contains 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
var n = 1; | |
console.log(n.toFixed(2)); | |
// To change the number directly: | |
// 1. Use parentheses: | |
console.log((1).toFixed(2)); | |
// 2. Use two dots: | |
console.log(1..toFixed(2)); | |
// Number binary representation: | |
console.log(20..toString(2)); |
This file contains 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
/** | |
* Computes the factorial of a given non-negative integer using iterative solution. | |
* @param {number} n The positive integer. | |
* @return {number} Returns a factorial of 'n'. | |
* @see https://en.wikipedia.org/wiki/Factorial | |
*/ | |
function factorial(n) { | |
var result = 1; | |
for (var i = 1; i <= n; ++i) { |
This file contains 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
/** | |
* +------------------------------------+ | |
* | FIBONACCI TABLE | | |
* +------------------------------------+ | |
* | n 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | |
* | xn 0 | 1 | 1 | 2 | 3 | 5 | 8 | 13 | | |
* +------------------------------------+ | |
* | |
* @see https://en.wikipedia.org/wiki/Big_O_notation | |
* @see https://en.wikipedia.org/wiki/Fibonacci_number#Sequence_properties |
This file contains 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
<script src="https://komito.net/komito.js" async></script> | |
<script> | |
// The default configuration can be omitted and only changed properties can be included. | |
var _komito = _komito || { | |
'trackTwitter': 1, // Tracks Twitter events if widget is presented on page. | |
'trackFacebook': 1, // Tracks Facebook events if widget is presented on page. | |
'trackLinkedIn': 1, // Tracks LinkedIn events if plugin is presented on page. | |
'trackDownloads': 1, // Tracks files download links. | |
'trackOutbound': 1, // Tracks outbound links. |
This file contains 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
/** | |
* Merge two sorted integer arrays nums1 and nums2 into nums1, sorted in non-decreasing order. | |
* The time complexity of this function is O(m + n), | |
* @param {number[]} nums1 The first sorted array containing elements to be merged. | |
* @param {number} m The number of elements in nums1 (excluding additional space for merging). | |
* @param {number[]} nums2 The second sorted array containing elements to be merged into nums1. | |
* @param {number} n The number of elements in nums2. | |
* @see https://leetcode.com/problems/merge-sorted-array/ | |
*/ | |
var merge = function(nums1, m, nums2, n) { |
This file contains 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
* { | |
box-sizing: border-box; | |
margin: 0; | |
padding: 0; | |
} | |
body { | |
display: flex; | |
flex-direction: column; | |
min-height: 100vh; |
This file contains 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
<body> | |
<header>Header</header> | |
<div id="main"> | |
<article>Content</article> | |
<aside>Left sidebar</aside> | |
<aside>Right sidebar</aside> | |
</div> | |
<footer>Footer</footer> | |
</body> |
This file contains 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
aside, footer, header, #main > article { | |
padding: 1em; | |
} |
This file contains 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
body { | |
background-color: White; | |
color: DarkSlateGray; | |
} | |
header, | |
footer { | |
background-color: Indigo; | |
color: White; | |
} | |
#main > aside { |
This file contains 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
body { | |
font-family: arial, sans-serif; | |
-webkit-font-smoothing: antialiased; | |
} | |
#main { | |
margin: 5em auto 0; | |
} | |
header, |
OlderNewer