ãã®ã¹ãã«ãã¹ãã®ç®çã¯ãé åã®è¨äºãçè§£ãã¦ãããã©ãããè©ä¾¡ãããã¨ã§ãã
ã¡ã¢: æå©ããå¿ è¦ãªå ´åã¯ãã¹ãã«ãã¹ã使ç¨ã¬ã¤ãããèªã¿ãã ãããã¾ããã³ãã¥ãã±ã¼ã·ã§ã³ãã£ãã«ã®ããããã使ç¨ãã¦ãç§ãã¡ã«é£çµ¡ãããã¨ãã§ãã¾ãã
ã¡ã¢: ãã®èª²é¡ã¯ããã®ã³ã¼ã¹ã§ã¯ã¾ã æç¤ºçã«æ±ã£ã¦ããªã JavaScript ã®æ©è½ã«é ¼ã£ã¦ãããããããé£ããç®æ¨ã§ããæåãå°½ããã¦ãããããªããã¨ã¯ãªã³ã©ã¤ã³ã§æ å ±ãæ¢ãã¦ãã ããã
é å 1ãã®èª²é¡ã§ã¯ãé åã®åºæ¬çãªç·´ç¿ããã¾ãã
myArray
ã¨ãã夿°ã«æ ¼ç´ãã¾ããã¢ã¤ãã ã¯ãã好ããªãã®ãªãä½ã§ããã¾ãã¾ããã好ããªé£ã¹ç©ããã³ãåãªã©ã¯ã©ãã§ããããã* {
box-sizing: border-box;
}
p {
color: purple;
margin: 0.5em 0;
}
// ããã«ã³ã¼ãã追å
// 以ä¸ã®ã³ã¼ãã¯ç·¨éããªãã§ãã ããã
const section = document.querySelector("section");
const para1 = document.createElement("p");
para1.textContent = `Array: ${myArray}`;
section.appendChild(para1);
ãããã¯ãªãã¯ããã¨ã模ç¯è§£çã表示ãã¾ãã
宿ãã JavaScript ã¯ã次ã®ããã«ãªãã§ãããã
const myArray = ["cats", "dogs", "chickens"];
myArray[0] = "horses";
myArray[1] = "pigs";
myArray.unshift("crocodiles");
// 以ä¸ã®ã³ã¼ãã¯ç·¨éããªãã§ãã ããã
// ...
é
å 2
ãã¦ãå¥ã®èª²é¡ã«ç§»ãã¾ããããããã§ã¯ãåãçµãã¹ãæååãä¸ãããã¦ãã¾ãã
ãã®èª²é¡ã宿ãããã«ã¯ã次ã®ããã«ãã¾ãã
+
ã¨ããæåãåãé¤ãã¾ããçµæã myArray
ã¨ãã夿°ã«æ ¼ç´ãã¾ãããarrayLength
ã¨ãã夿°ã«æ ¼ç´ãã¾ããããlastItem
ã¨ãã夿°ã«æ ¼ç´ãã¾ããããconst myString = "Ryu+Ken+Chun-Li+Cammy+Guile+Sakura+Sagat+Juri";
// ããã«ã³ã¼ãã追å
// 以ä¸ã®ã³ã¼ãã¯ç·¨éããªãã§ãã ããã
const section = document.querySelector("section");
const para1 = document.createElement("p");
para1.textContent = `Array: ${myArray}`;
const para2 = document.createElement("p");
para2.textContent = `The length of the array is ${arrayLength}.`;
const para3 = document.createElement("p");
para3.textContent = `The last item in the array is "${lastItem}".`;
section.appendChild(para1);
section.appendChild(para2);
section.appendChild(para3);
ãããã¯ãªãã¯ããã¨ã模ç¯è§£çã表示ãã¾ãã
宿ãã JavaScript ã¯ã次ã®ããã«ãªãã§ãããã
const myString = "Ryu+Ken+Chun-Li+Cammy+Guile+Sakura+Sagat+Juri";
let myArray = myString.split("+");
let arrayLength = myArray.length;
let lastItem = myArray[arrayLength - 1];
// 以ä¸ã®ã³ã¼ãã¯ç·¨éããªãã§ãã ããã
// ...
é
å 3
ãã®ã¿ã¹ã¯ã§ã¯ãç¨æããé åãåºçºç¹ã¨ãã¦ãããéè¡ãã使¥ãè¡ãã¾ããå ·ä½çã«ã¯ã
Ryu (0)
ã ãªãããã®ããæ¹ã¯é
åã®è¨äºã§ã¯æãã¦ãã¾ããã®ã§ãèªåã§èª¿ã¹ãå¿
è¦ãããã§ãããã"-"
ã§åºåã£ã¦ 1 ã¤ã®æååã«çµåãã myString
ã¨ãã夿°ã«æ ¼ç´ãã¾ããããconst myArray = [
"Ryu",
"Ken",
"Chun-Li",
"Cammy",
"Guile",
"Sakura",
"Sagat",
"Juri",
];
// ããã«ã³ã¼ãã追å
// 以ä¸ã®ã³ã¼ãã¯ç·¨éããªãã§ãã ããã
const section = document.querySelector("section");
const para1 = document.createElement("p");
para1.textContent = myString;
section.appendChild(para1);
ãããã¯ãªãã¯ããã¨ã模ç¯è§£çã表示ãã¾ãã
宿ãã JavaScript ã¯ã次ã®ããã«ãªãã§ãããã
const myArray = [
"Ryu",
"Ken",
"Chun-Li",
"Cammy",
"Guile",
"Sakura",
"Sagat",
"Juri",
];
myArray.pop();
myArray.push("Zangief");
myArray.push("Ibuki");
myArray.forEach((element, index) => {
const newElement = `${element} (${index})`;
myArray[index] = newElement;
});
const myString = myArray.join(" - ");
// 以ä¸ã®ã³ã¼ãã¯ç·¨éããªãã§ãã ããã
// ...
é
å 4
ãã®é åã®èª²é¡ã§ã¯ãããã¤ãã®é³¥ã®ååãè¨è¼ããé åãæä¾ãã¦ãã¾ãã
ãã®èª²é¡ã宿ãããã«ã¯ã次ã®ããã«ãã¾ãã
"Eagles"
è¦ç´ ã®ã¤ã³ããã¯ã¹ãç¹å®ãããã®ã¤ã³ããã¯ã¹ãç¨ã㦠"Eagles"
è¦ç´ ãåé¤ãã¾ããããeBirds
ã¨ããååã®æ°ããé
åã使ãã¾ããããã¡ãªã¿ã«ã startsWith()
ã¯æååãç¹å®ã®æåã§å§ã¾ããã©ããã調ã¹ãã®ã«ã¨ã¦ãå½¹ç«ã¡ã¾ãã"Emus,Egrets"
ã¨è¡¨ç¤ºããããæåã§ãã
const birds = ["Parrots", "Falcons", "Eagles", "Emus", "Caracaras", "Egrets"];
// ããã«ã³ã¼ãã追å
// 以ä¸ã®ã³ã¼ãã¯ç·¨éããªãã§ãã ããã
const section = document.querySelector("section");
const para1 = document.createElement("p");
para1.textContent = eBirds;
section.appendChild(para1);
ãããã¯ãªãã¯ããã¨ã模ç¯è§£çã表示ãã¾ãã
宿ãã JavaScript ã¯ã次ã®ããã«ãªãã§ãããã
const birds = ["Parrots", "Falcons", "Eagles", "Emus", "Caracaras", "Egrets"];
const eaglesIndex = birds.indexOf("Eagles");
birds.splice(eaglesIndex, 1);
function startsWithE(bird) {
return bird.startsWith("E");
}
const eBirds = birds.filter(startsWithE);
// 以ä¸ã®ã³ã¼ãã¯ç·¨éããªãã§ãã ããã
// ...
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4