xxxxxxxxxx
var colors = ["red","blue","green"];
for (var i = 0; i < colors.length; i++) {
console.log(colors[i]);
}
xxxxxxxxxx
let colors = ['red', 'green', 'blue'];
for (const color of colors){
console.log(color);
}
xxxxxxxxxx
var numbers = [22, 44, 55, 66, 77, 99];
for (var i = 0; i < numbers.length; i++) {
var num = numbers[i]
console.log(num)
}
//Output: 22,44,55 66 77 99
xxxxxxxxxx
char s1[] = "Semester 1."; char s2[] = "Semester 2."; if (strncmp(s1, s2, 10) == 0) printf("Equal\n"); else printf("Not equal\n"); }
xxxxxxxxxx
BaseException
+-- SystemExit
+-- KeyboardInterrupt
+-- GeneratorExit
+-- Exception
+-- StopIteration
+-- StopAsyncIteration
+-- ArithmeticError
| +-- FloatingPointError
| +-- OverflowError
| +-- ZeroDivisionError
+-- AssertionError
+-- AttributeError
+-- BufferError
+-- EOFError
+-- ImportError
| +-- ModuleNotFoundError
+-- LookupError
| +-- IndexError
| +-- KeyError
+-- MemoryError
+-- NameError
| +-- UnboundLocalError
+-- OSError
| +-- BlockingIOError
| +-- ChildProcessError
| +-- ConnectionError
| | +-- BrokenPipeError
| | +-- ConnectionAbortedError
| | +-- ConnectionRefusedError
| | +-- ConnectionResetError
| +-- FileExistsError
| +-- FileNotFoundError
| +-- InterruptedError
| +-- IsADirectoryError
| +-- NotADirectoryError
| +-- PermissionError
| +-- ProcessLookupError
| +-- TimeoutError
+-- ReferenceError
+-- RuntimeError
| +-- NotImplementedError
| +-- RecursionError
+-- SyntaxError
| +-- IndentationError
| +-- TabError
+-- SystemError
+-- TypeError
+-- ValueError
| +-- UnicodeError
| +-- UnicodeDecodeError
| +-- UnicodeEncodeError
| +-- UnicodeTranslateError
+-- Warning
+-- DeprecationWarning
+-- PendingDeprecationWarning
+-- RuntimeWarning
+-- SyntaxWarning
+-- UserWarning
+-- FutureWarning
+-- ImportWarning
+-- UnicodeWarning
+-- BytesWarning
+-- ResourceWarning
xxxxxxxxxx
moment().format('MMMM Do YYYY, h:mm:ss a'); // December 5th 2021, 7:39:21 pm
moment().format('dddd'); // Sunday
moment().format("MMM Do YY"); // Dec 5th 21
moment().format('YYYY [escaped] YYYY'); // 2021 escaped 2021
moment().format(); // 2021-12-05T19:39:21-08:00
xxxxxxxxxx
String.prototype.replaceAt = function (index, char) {
return this.substr(0, index) + char + this.substr(index + char.length);
}
mystring.replaceAt(4, '')
xxxxxxxxxx
// CustomerSearchResults.tsx
import * as React from "react";
import Customer from "./Customer";
interface CustomerSearchResultsProps {
customers: Customer[];
}
const CustomerSearchResults = (props: CustomerSearchResultsProps) => {
const rows = props.customers.map(customer => (
<tr key={customer.id}>
<th>{customer.id}</th>
<td>{customer.name}</td>
<td>{customer.revenue}</td>
<td>{customer.firstSale.toString()}</td>
</tr>
));
return (
<table className="table table-hover">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>Revenue</th>
<th>First Sale</th>
</tr>
</thead>
<tbody>{rows}</tbody>
</table>
);
};
export default CustomerSearchResults;
xxxxxxxxxx
//create an array like so:
var colors = ["red","blue","green"];
//you can loop through an array like this:
for (var i = 0; i < colors.length; i++) {
console.log(colors[i]);
}