<script src="https://unpkg.com/vue@2.4.2/dist/vue.min.js"></script>
<script>
new Vue({
el: '#app',
data: {
items: [
'aaa',
'bbb',
'ccc',
'ddd',
'eee',
'fff'
]
}
})
</script>
<div id="app">
<ul>
<li v-for="item in items.slice(2)">{{ item }}</li>
</ul>
</div>
Category: a
how to square a value in javascript
// Use Math.pow(a,b); where a is your value and b is the exponent
var num = Math.pow(4, 2);
//num returns 16
how to sort a list in js
var points = [40, 100, 1, 5, 25, 10];
points.sort(function(a, b){return a-b});
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.sort();
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.sort();
how to split a string in javascript
//split into array of strings.
var str = "Well, how, are , we , doing, today";
var res = str.split(",");
strName.split(); // My code
// bad example https://stackoverflow.com/questions/6484670/how-do-i-split-a-string-into-an-array-of-characters/38901550#38901550
var arr = foo.split('');
console.log(arr); // ["s", "o", "m", "e", "s", "t", "r", "i", "n", "g"]
var str = 'It iS a 5r&e@@t Day.'
var array = str.split(" ");
print(array);
var str = 'It iS a 5r&e@@t Day.'
var array = str.split(" ",2);
print(array);
var str = "How are you doing today?";
var res = str.split(" ");
// Split string into an array of strings
const path = "/usr/home/chucknorris"
let result = path.split("/")
console.log(result)
// result
// ["", "usr", "home", "chucknorris"]
let username = result[3]
console.log(username)
// username
// "chucknorris"
how to set up a json file
how to setup a react project from scratch
npx create-react-app my-app // npx on the first line is not a typo
cd my-app
npm start
mkdir new-react-app
cd new-react-app
npm init --y
how to show a certain position in javascript
//How to print a specific element in javascript
/*====DESCRIPTION starts here=====
You can output a specific element or position of a list/array by
using the output statement which is console.log(). Within it, type in the
name of the array in which you are dealing with, and specify with brackets
after the array name, enter the number of the
position you want to output. Note though that as computers
count beginning from 0, you will have to subtract
1 from the original position we percieve.
====DESRCIPTION ends here=======*/
//====EXAMPLE 1 STARTS HERE=========
//Using an integer to output a specific element/position of an array.
//array named "arr" which consists of 4 elements which are integers.
var arr = [3,4,5,2]
console.log(arr[2]) //Outputs "5" because 5 is the second (or third) element of the array.
//====EXAMPLE 1 ENDS HERE=========
//====EXAMPLE 2 STARTS==========
//Using a variable to output a specific element/position of an array.
//array named "arr" which consists of 4 elements which are integers.
var arr = [8,9,3,5]
//A variable named "i" which stores a value of an integer, 2.
//Will be used to output the second element of the array.
var x = 0
console.log(arr[x]) //Outputs "8" since 8 is the 0 (or first) elemnt of the arary.
//====EXAMPLE 2 ENDS HERE==========
how to set a status with discord.js
//have your regular bot status code
type: "streaming", url: "https://www.twitch.tv/name"
client.user.setActivity("INSERT TEXT HERE");
how to send a command in js
<form action="">
<select name="channel">
<option value="#channel1">channel1</option>
<option value="#channel2">channel2</option>
</select>
</form>