ì´ì ê¹ì§ 문ìì´ì 기ì´ë¥¼ ì´í´ë³´ììµëë¤. ì´ì ë¶í° - í ì¤í¸ 문ìì´ì ê¸¸ì´ ì°¾ê¸°, 문ìì´ í©ì¹ê¸° ë° ìª¼ê°ê¸° ë±ê³¼ ê°ì- ë´ì¥ë ë©ìë를 ì¬ì©íì¬ ë¬¸ìì´ìì ìíí ì ìë ì ì©í ìì ì ëí´ ìê°í´ ë´ ìë¤. 문ìì´ì í 문ì를 ë¤ë¥¸ 문ìë¡ ëì²´íë ë±ì ìì ì ìíí©ëë¤.
íìí ì¬ì ì§ì: 기본 ì»´í¨í° íì© ë¥ë ¥, HTML ë° CSSì ëí 기본ì ì¸ ì´í´, JavaScriptê° ë¬´ìì¸ì§ ì´í´í©ëë¤. 목í: 문ìì´ì´ ê°ì²´ìì ì´í´íê³ , í´ë¹ ê°ì²´ìì ì¬ì©í ììë ëª ê°ì§ 기본 ë©ìë를 ì¬ì©íì¬ ë¬¸ìì´ì ì¡°ìíë ë°©ë²ì ë°°ìëë¤. Strings as objectsì´ì ì ë§íì§ë§, ë¤ì ë§íë©´ - JavaScriptì 모ë ê²ì´ ê°ì²´ì ëë¤. 문ìì´ì ë§ë¤ ë, ì를 ë¤ë©´
var string = "This is my string";
ë³ìê° ë¬¸ìì´ ê°ì²´ ì¸ì¤í´ì¤ëë©´, ê²°ê³¼ì ì¼ë¡ ìë§ì ìì±ê³¼ ë©ìëê° ì¬ì© ê°ë¥íê² ë©ëë¤. String ê°ì²´ íì´ì§ë¡ ì´ëíì¬ íì´ì§ 측면ì 목ë¡ì ë´ë ¤ë¤ ë³´ë©´ ì´ê²ì ë³¼ ì ììµëë¤!
ì´ì ëê° ë ¹ê¸° ììí기 ì ì, ê±±ì íì§ ë§ììì¤! íìµ ì¬í ì¤ì ì´ê¸°ì ëë¶ë¶ì ì íìê° ììµëë¤. ê·¸ë¬ë ì¬ê¸°ìì ì´í´ë³¼ ëª ê°ì§ ì¬íì ì주 ì¬ì©íê² ë ê²ì ëë¤.
ì½ìì ìì 를 ìì±í´ ë³´ì¸ì. ìëì í ê°ì§ë¥¼ ì ê³µí©ëë¤(ì íì´ë ì ì°½ìì ì½ìì ì´ ì ìê³ , ë¸ë¼ì°ì ì ê°ë°ì ì½ìì ì¬ì©í ìë ììµëë¤).
문ìì´ì ê¸¸ì´ ì°¾ê¸°ê°ë¨í©ëë¤ â ê°ë¨íê² length
íë¡í¼í°ë¥¼ ì¬ì©í ì ììµëë¤. ë¤ì ì½ë를 ì
ë ¥í´ ë³´ì¸ì.
var browserType = "mozilla";
browserType.length;
ê²°ê³¼ë 7ì 리í´í´ì¼ í©ëë¤. 'mozilla'ë 7ê¸ìì´ê¸° ë문ì ëë¤. ì´ê²ì ì¬ë¬ ê°ì§ ì´ì ë¡ ì ì©í©ëë¤. ì를 ë¤ì´ ì´ë¦ì 길ì´ì ë°ë¼ ì´ë¦ì ìì를 ì ë ¬í´ì¼ íëê°, ì ì ê° ìì±í ì´ë¦ì´ í¹ì ê¸¸ì´ ì´ìì¼ ë ë무 길ë¤ë ê²ì ìë ¤ì¤ì¼ íë ê²½ì°ì ì¬ì©í ì ììµëë¤.
í¹ì 문ìì´ ì°¾ê¸°ê´ë ¨íì¬, ëê´í¸ í기ë²ì ì´ì©í´ì 문ìì´ ìì 문ì를 구í ì ììµëë¤. ëê´í¸ í기ë²ì ë³ìëª ëì ëê´í¸ë¥¼ í¬í¨í©ëë¤. ëê´í¸ ììë 구íê³ ì¶ì 문ìì ì«ì를 í¬í¨ìí¤ë©´ ëë©°, ì를 ë¤ì´ ìëì ê²½ì° ì²« ë²ì§¸ 문ì를 구í ì ììµëë¤:
ì»´í¨í°ë 1ì´ ìëë¼ 0ë¶í° ì«ì를 ì
ëë¤! 문ìì´ì ë§ì§ë§ 문ì를 구í기 ìí´ì, ì°ë¦¬ë ë¤ì ì½ë를 ì¬ì©í ì ìì¼ë©°, 기ì ì ì¸ length
íë¡í¼í°ê³¼ ê°ì´ ì¬ì©íë©´ ìëì ê°ìµëë¤:
browserType[browserType.length - 1];
"mozilla"ë 7ê¸ìì´ì§ë§, ì«ìë 0ë¶í° ììí기 ë문ì ê¸ìì ìì¹ë 6ì
ëë¤. ê·¸ë 기 ë문ì length-1
ì ì¬ì©í©ëë¤. ì를 ë¤ì´, ì¬ë¬ 문ìì´ ì¤ ì²« ë²ì§¸ 문ì를 ì°¾ì ìíë²³ìì¼ë¡ ì ë ¬í´ì¼ í ê²½ì°ì ì¬ì©í ì ììµëë¤.
ëëë¡ í° ë¬¸ìì´ ìì ìì 문ìì´(ì°ë¦¬ë ì´ê²ì íì 문ìì´ì´ë¼ê³ ì´ì¼ê¸° íë¤.)ì ì°¾ê³ ì¶ì ê²ì
ëë¤. ì´ ìì
ì indexOf()
를 ì¬ì©íì¬ ìë£í ì ììµëë¤, which takes a single parameter â 찾기 ìíë íì 문ìì´ì ì°¾ì ì ììµëë¤. ìëí´ ë´
ìë¤:
browserType.indexOf("zilla");
ê²°ê³¼ë 2ì ëë¤. íì 문ìì´ì¸ "zilla"ë "mozilla'ì 2ë² ìì¹(0, 1, 2â ê·¸ë¬ë¯ë¡ 3ë²ì§¸ 문ìì´)ìì ììí©ëë¤. ì´ë¬í ì½ëë 문ìì´ì íí°ë§íë ë° ì¬ì©ë ì ììµëë¤. ì를 ë¤ì´ ì¹ ì£¼ì 목ë¡ìì "mozilla"ê° í¬í¨ë 주ìë§ ì¸ìíê³ ì¶ì ê²½ì°ì ëë¤.
ë¤ë¥¸ ë°©ë²ì¼ë¡ë í ì ìì¼ë©°, ëì± í¨ì¨ì ì¼ ì ììµëë¤. ë¤ì ìì 를 ë°ë¼í´ ë´ ìë¤:
browserType.indexOf("vanilla");
ì´ë ê² íë©´ -1( íì 문ìì´ (ì´ ê²½ì° 'vanilla')ì´ ê¸°ë³¸ 문ìì´ìì ë°ê²¬ëì§ ìì¼ë©´ ë°ííë¤.)ì 결과를 ì»ì ì ììµëë¤.
íì 문ìì´ 'mozilla'ê° í¬í¨ëì§ ìì 문ìì´ì 모ë ì¸ì¤í´ì¤ë¥¼ ì°¾ì¼ë ¤ë©´ ì´ ì°ì°ì를 ì¬ì©íê³ ìëì íìë ê²ì²ë¼ ë¶ì ì°ì°ì를 ì¬ì©í´ì ìì ì ìíí ì ììµëë¤. ë¤ìê³¼ ê°ì´ í ì ììµëë¤:
if (browserType.indexOf("mozilla") !== -1) {
// do stuff with the string
}
문ìì´ ë´ìì ë¶ë¶ 문ìì´ì´ ì´ëìì ììëê³ ì´ë¤ 문ìë¡ ëëëì§ ìê³ ì¶ì¼ë©´ slice()
를 ì¬ì©íì¬ ë¬¸ìì´ì ì¶ì¶í ì ììµëë¤. ë¤ìì ìëí´ ë´
ìë¤:
"moz"를 ë°íí©ëë¤ - 첫 ë²ì§¸ íë¼ë©í°ë ì¶ì¶ì ììí 문ì ìì¹ì´ê³ ë ë²ì§¸ íë¼ë©í°ë ì¶ì¶í 문ìì ê°¯ìì ëë¤. ë°ë¼ì ì¬ë¼ì´ì¤ë 첫 ë²ì§¸ ìì¹ììë¶í° ì¸ ë²ì§¸ ìì¹ê¹ì§ í¬í¨ë©ëë¤.
ëí í¹ì 문ì ë¤ì 문ìì´ì ëë¨¸ì§ ë¬¸ì를 모ë ì¶ì¶íë ¤ë ê²½ì° ë ë²ì§¸ ë§¤ê° ë³ì를 í¬í¨íì§ ìê³ ë¬¸ìì´ìì ëë¨¸ì§ ë¬¸ì를 ì¶ì¶í ìì¹ì 문ì ìì¹ë§ í¬í¨íë©´ ë©ëë¤. ë¤ìì ìëí´ë³´ììì¤.
ì´ë ê² íë©´ "zilla"ê° ë°íë©ëë¤. 문ìì 2ë²ì§¸ ìì¹ë "z"ì´ê³ ë ë²ì§¸ ë§¤ê° ë³ì를 í¬í¨íì§ ìì기 ë문ì ë°íë íì 문ìì´ì 문ìì´ì ëë¨¸ì§ ë¬¸ì 모ëì ëë¤.
ë/ì문ì ë³ê²½ì°¸ê³ :
slice()
has other options too; study theslice()
page to see what else you can find out.
문ìì´ ë©ìë toLowerCase()
ìtoUpperCase()
ë 문ìì´ì ê°ì ¸ì ê·¸ê²ì 모ë ê°ê° ë문ìë ì문ìë¡ ë°ê¿ëë¤. ì´ë ë°ì´í°ë² ì´ì¤ì ì ì¥í기 ì ì 모ë ì¬ì©ì ì
ë ¥ ë°ì´í°ë¥¼ íì¤ííë ¤ë ê²½ì° ì ì©í©ëë¤.
ë¤ì íì ì ë ¥íì¬ ì´ë»ê² ëëì§ ì´í´ë³´ê² ìµëë¤.
var radData = "My NaMe Is MuD";
radData.toLowerCase();
radData.toUpperCase();
문ìì´ì ì¼ë¶ë¥¼ ë³ê²½í기
문ìì´ ë´ì í íì 문ìì´ì replace()
를 íµí´ ë¤ë¥¸ íì 문ìì´ë¡ ë°ê¿ ì ììµëë¤. ì´ ìì
ì 기본ì ì¸ ìì¤ìì ë§¤ì° ê°ë¨íê² ìëí©ëë¤. íì§ë§ ìì§ ìëí´ë³´ì§ ìì ê³ ê¸ ìì
ë ììµëë¤.
ê·¸ê²ì 2ê°ì 매ê°ë³ì를 ê°ì§ëë¤. â ë°ëì ë¹íë 문ìì ë°ê¾¸ë ¤ë 문ìì ëë¤. ë¤ì ìì 를 ë°ë¼í´ë³´ì¸ì.:
browserType.replace("moz", "van");
ìì
ì´ ì¹ì ììë 문ìì´ì ë¤ë£¨ë ë°©ë²ì ì¤ëª í©ëë¤. ìëì ê° ì¤ìµììë 문ìì´ë¡ ì´ë£¨ì´ì§ ë°°ì´ì 루í문ì ì¬ì©í´ bullet list(ë¶ë¦¿ 리ì¤í¸)ë¡ íííììµëë¤. ì§ê¸ ë°°ì´ì´ë 루í를 ì´í´í íìê° ììµëë¤. - ì´ë¬í ë´ì©ì ì¶íì ì¤ëª í©ëë¤. ì¤ìíê²ì ê°ê°ì 문ìì´ì´ ì°ë¦¬ê° ìíë íìì¼ë¡ ì¶ë ¥íë ì½ë를 ìì±íë ê²ì ëë¤.
ê° ìì ìë 리ì ë²í¼ì´ ìê³ , 리ì ë²í¼ì ì¤ì를 íê±°ë ì½ëê° ìëíì§ ììì ì¬ì¤ì íëë° ì¬ì©í ì ììµëë¤. í´ê²° ë°©ë²ì 모를 ë, í´ëµ ë²í¼(solution button)ì ë르면 í´ëµì ë³¼ ì ììµëë¤.
ì¸ì¬ë§ íí°ë§ í기첫 ë²ì§¸ ìì ë ê°ë¨í ììí´ë´ ìë¤. ì°ë¦¬ë ë°°ì´ì ë¤ì´ìë í¬ë¦¬ì¤ë§ì¤ ì¸ì¬ë§ ë©ìì§ë¥¼ ì ë ¬íë ¤ê³ í©ëë¤. if(...)ì ì¬ì©í´ ê° ë¬¸ìì´ì ë¹êµíê³ í¬ë¦¬ì¤ë§ì¤ ë©ìì§ì¸ ê²½ì°ì 목ë¡ë§ ì¸ìíë ¤ê³ í©ëë¤.
<h2>Live output</h2>
<div class="output" style="min-height: 125px;">
<ul></ul>
</div>
<h2>Editable code</h2>
<p class="a11y-label">
Press Esc to move focus away from the code area (Tab inserts a tab character).
</p>
<textarea id="code" class="playable-code" style="height: 290px; width: 95%">
const list = document.querySelector('.output ul');
list.innerHTML = '';
const greetings = ['Happy Birthday!',
'Merry Christmas my love',
'A happy Christmas to all the family',
'You\'re all I want for Christmas',
'Get well soon'];
for (let greeting of greetings) {
// Your conditional test needs to go inside the parentheses
// in the line below, replacing what's currently there
if (greeting) {
const listItem = document.createElement('li');
listItem.textContent = greeting;
list.appendChild(listItem);
}
}
</textarea>
<div class="playable-buttons">
<input id="reset" type="button" value="Reset" />
<input id="solution" type="button" value="Show solution" />
</div>
html {
font-family: sans-serif;
}
h2 {
font-size: 16px;
}
.a11y-label {
margin: 0;
text-align: right;
font-size: 0.7rem;
width: 98%;
}
body {
margin: 10px;
background: #f5f9fa;
}
const textarea = document.getElementById("code");
const reset = document.getElementById("reset");
const solution = document.getElementById("solution");
let code = textarea.value;
let userEntry = textarea.value;
function updateCode() {
eval(textarea.value);
}
reset.addEventListener("click", function () {
textarea.value = code;
userEntry = textarea.value;
solutionEntry = jsSolution;
solution.value = "Show solution";
updateCode();
});
solution.addEventListener("click", function () {
if (solution.value === "Show solution") {
textarea.value = solutionEntry;
solution.value = "Hide solution";
} else {
textarea.value = userEntry;
solution.value = "Show solution";
}
updateCode();
});
const jsSolution = `const list = document.querySelector('.output ul');
list.innerHTML = '';
const greetings = ['Happy Birthday!',
'Merry Christmas my love',
'A happy Christmas to all the family',
'You\\\'re all I want for Christmas',
'Get well soon'];
for (let greeting of greetings) {
// Your conditional test needs to go inside the parentheses
// in the line below, replacing what's currently there
if (greeting.includes('Christmas')) {
const listItem = document.createElement('li');
listItem.textContent = greeting;
list.appendChild(listItem);
}
}`;
let solutionEntry = jsSolution;
textarea.addEventListener("input", updateCode);
window.addEventListener("load", updateCode);
// stop tab key tabbing out of textarea and
// make it write a tab at the caret position instead
textarea.onkeydown = function (e) {
if (e.keyCode === 9) {
e.preventDefault();
insertAtCaret("\t");
}
if (e.keyCode === 27) {
textarea.blur();
}
};
function insertAtCaret(text) {
const scrollPos = textarea.scrollTop;
let caretPos = textarea.selectionStart;
const front = textarea.value.substring(0, caretPos);
const back = textarea.value.substring(
textarea.selectionEnd,
textarea.value.length,
);
textarea.value = front + text + back;
caretPos = caretPos + text.length;
textarea.selectionStart = caretPos;
textarea.selectionEnd = caretPos;
textarea.focus();
textarea.scrollTop = scrollPos;
}
// Update the saved userCode every time the user updates the text area code
textarea.onkeyup = function () {
// We only want to save the state when the user code is being shown,
// not the solution, so that solution is not saved over the user code
if (solution.value === "Show solution") {
userEntry = textarea.value;
} else {
solutionEntry = textarea.value;
}
updateCode();
};
ë/ì문ì ë§ê² ìì í기
ì´ ìì ìë ìêµ ëìì ì´ë¦ë¤ì 모ìë¨ìµëë¤ë§ ë/ì문ìê° ì못ëì´ ììµëë¤. ì°ë¦¬ë ì´ ë¬¸ìë¤ì 첫 ë²ì§¸ 문ì를 ì ì¸íê³ ëª¨ë ì문ìë¡ ë³ê²½í´ì¼ í©ëë¤. ì´ê²ì ë¤ìê³¼ ê°ì ë°©ìì¼ë¡ í ì ììµëë¤:
input
ë³ìì ë´ê¸´ 문ìì´ ì 체를 ì문ìë¡ ë³íí í ìë¡ì´ ë³ìì ì ì¥íì¸ì.result
variable to equal to the final result, not the input
.ì°¸ê³ : A hint â the parameters of the string methods don't have to be string literals; they can also be variables, or even variables with a method being invoked on them.
<h2>Live output</h2>
<div class="output" style="min-height: 125px;">
<ul></ul>
</div>
<h2>Editable code</h2>
<p class="a11y-label">
Press Esc to move focus away from the code area (Tab inserts a tab character).
</p>
<textarea id="code" class="playable-code" style="height: 250px; width: 95%">
const list = document.querySelector('.output ul');
list.innerHTML = '';
const cities = ['lonDon', 'ManCHESTer', 'BiRmiNGHAM', 'liVERpoOL'];
for (let city of cities) {
// write your code just below here
const result = city;
const listItem = document.createElement('li');
listItem.textContent = result;
list.appendChild(listItem);
}
</textarea>
<div class="playable-buttons">
<input id="reset" type="button" value="Reset" />
<input id="solution" type="button" value="Show solution" />
</div>
html {
font-family: sans-serif;
}
h2 {
font-size: 16px;
}
.a11y-label {
margin: 0;
text-align: right;
font-size: 0.7rem;
width: 98%;
}
body {
margin: 10px;
background: #f5f9fa;
}
const textarea = document.getElementById("code");
const reset = document.getElementById("reset");
const solution = document.getElementById("solution");
let code = textarea.value;
let userEntry = textarea.value;
function updateCode() {
eval(textarea.value);
}
reset.addEventListener("click", function () {
textarea.value = code;
userEntry = textarea.value;
solutionEntry = jsSolution;
solution.value = "Show solution";
updateCode();
});
solution.addEventListener("click", function () {
if (solution.value === "Show solution") {
textarea.value = solutionEntry;
solution.value = "Hide solution";
} else {
textarea.value = userEntry;
solution.value = "Show solution";
}
updateCode();
});
const jsSolution = `const list = document.querySelector('.output ul');
list.innerHTML = '';
const cities = ['lonDon', 'ManCHESTer', 'BiRmiNGHAM', 'liVERpoOL'];
for (let city of cities) {
// write your code just below here
const lower = city.toLowerCase();
const firstLetter = lower.slice(0,1);
const capitalized = lower.replace(firstLetter,firstLetter.toUpperCase());
const result = capitalized;
const listItem = document.createElement('li');
listItem.textContent = result;
list.appendChild(listItem);
}`;
let solutionEntry = jsSolution;
textarea.addEventListener("input", updateCode);
window.addEventListener("load", updateCode);
// stop tab key tabbing out of textarea and
// make it write a tab at the caret position instead
textarea.onkeydown = function (e) {
if (e.keyCode === 9) {
e.preventDefault();
insertAtCaret("\t");
}
if (e.keyCode === 27) {
textarea.blur();
}
};
function insertAtCaret(text) {
const scrollPos = textarea.scrollTop;
let caretPos = textarea.selectionStart;
const front = textarea.value.substring(0, caretPos);
const back = textarea.value.substring(
textarea.selectionEnd,
textarea.value.length,
);
textarea.value = front + text + back;
caretPos = caretPos + text.length;
textarea.selectionStart = caretPos;
textarea.selectionEnd = caretPos;
textarea.focus();
textarea.scrollTop = scrollPos;
}
// Update the saved userCode every time the user updates the text area code
textarea.onkeyup = function () {
// We only want to save the state when the user code is being shown,
// not the solution, so that solution is not saved over the user code
if (solution.value === "Show solution") {
userEntry = textarea.value;
} else {
solutionEntry = textarea.value;
}
updateCode();
};
Making new strings from old parts
In this last exercise the array contains a bunch of strings containing information about train stations in the North of England. The strings are data items that contain the three letter station code, followed by some machine-readable data, followed by a semi-colon, followed by the human-readable station name. For example:
MAN675847583748sjt567654;Manchester Piccadilly
We want to extract the station code and name, and put them together in a string with the following structure:
MAN: Manchester Piccadilly
We'd recommend doing it like this:
result
variable to equal to the final string, not the input
.<h2>Live output</h2>
<div class="output" style="min-height: 125px;">
<ul></ul>
</div>
<h2>Editable code</h2>
<p class="a11y-label">
Press Esc to move focus away from the code area (Tab inserts a tab character).
</p>
<textarea id="code" class="playable-code" style="height: 285px; width: 95%">
const list = document.querySelector('.output ul');
list.innerHTML = '';
const stations = ['MAN675847583748sjt567654;Manchester Piccadilly',
'GNF576746573fhdg4737dh4;Greenfield',
'LIV5hg65hd737456236dch46dg4;Liverpool Lime Street',
'SYB4f65hf75f736463;Stalybridge',
'HUD5767ghtyfyr4536dh45dg45dg3;Huddersfield'];
for (let station of stations) {
// write your code just below here
const result = station;
const listItem = document.createElement('li');
listItem.textContent = result;
list.appendChild(listItem);
}
</textarea>
<div class="playable-buttons">
<input id="reset" type="button" value="Reset" />
<input id="solution" type="button" value="Show solution" />
</div>
html {
font-family: sans-serif;
}
h2 {
font-size: 16px;
}
.a11y-label {
margin: 0;
text-align: right;
font-size: 0.7rem;
width: 98%;
}
body {
margin: 10px;
background: #f5f9fa;
}
const textarea = document.getElementById("code");
const reset = document.getElementById("reset");
const solution = document.getElementById("solution");
let code = textarea.value;
let userEntry = textarea.value;
function updateCode() {
eval(textarea.value);
}
reset.addEventListener("click", function () {
textarea.value = code;
userEntry = textarea.value;
solutionEntry = jsSolution;
solution.value = "Show solution";
updateCode();
});
solution.addEventListener("click", function () {
if (solution.value === "Show solution") {
textarea.value = solutionEntry;
solution.value = "Hide solution";
} else {
textarea.value = userEntry;
solution.value = "Show solution";
}
updateCode();
});
const jsSolution = `const list = document.querySelector('.output ul');
list.innerHTML = '';
const stations = ['MAN675847583748sjt567654;Manchester Piccadilly',
'GNF576746573fhdg4737dh4;Greenfield',
'LIV5hg65hd737456236dch46dg4;Liverpool Lime Street',
'SYB4f65hf75f736463;Stalybridge',
'HUD5767ghtyfyr4536dh45dg45dg3;Huddersfield'];
for (let station of stations) {
// write your code just below here
const code = station.slice(0,3);
const semiColon = station.indexOf(';');
const name = station.slice(semiColon + 1);
const result = \`\${code}: \${name}\`;
const listItem = document.createElement('li');
listItem.textContent = result;
list.appendChild(listItem);
}`;
let solutionEntry = jsSolution;
textarea.addEventListener("input", updateCode);
window.addEventListener("load", updateCode);
// stop tab key tabbing out of textarea and
// make it write a tab at the caret position instead
textarea.onkeydown = function (e) {
if (e.keyCode === 9) {
e.preventDefault();
insertAtCaret("\t");
}
if (e.keyCode === 27) {
textarea.blur();
}
};
function insertAtCaret(text) {
const scrollPos = textarea.scrollTop;
let caretPos = textarea.selectionStart;
const front = textarea.value.substring(0, caretPos);
const back = textarea.value.substring(
textarea.selectionEnd,
textarea.value.length,
);
textarea.value = front + text + back;
caretPos = caretPos + text.length;
textarea.selectionStart = caretPos;
textarea.selectionEnd = caretPos;
textarea.focus();
textarea.scrollTop = scrollPos;
}
// Update the saved userCode every time the user updates the text area code
textarea.onkeyup = function () {
// We only want to save the state when the user code is being shown,
// not the solution, so that solution is not saved over the user code
if (solution.value === "Show solution") {
userEntry = textarea.value;
} else {
solutionEntry = textarea.value;
}
updateCode();
};
ê²°ë¡
JavaScriptìì 문ì¥ê³¼ ë¨ì´ë¤ì ë¤ë£° ì ìë íë¡ê·¸ëë° ë¥ë ¥ì´ ë§¤ì° ì¤ìíë¤. ì¹ì¬ì´í¸ë ì¬ëë¤ê³¼ ìíµíë ê³µê°ì´ê¸° ë문ì´ë¤. ì´ ë¬¸ìë 문ìì´ì ë¤ë£° ì ìë 기ì´ì ì¸ ë´ì©ì ëí´ ë¤ë£¨ìë¤. ì´ ë´ì©ì ìì¼ë¡ ë°°ì°ê² ë ì¬í ê³¼ì ì ëìì´ ë ê²ì´ë¤. ë¤ìì¼ë¡ ë°°ì´ì ëí´ ììë³´ê² ë¤.
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