codeit8 2023-06-13 javascript_string myString.indexof('[형]') It returns the starting index of the parameter. It can find if the whole part is in the string or not. When we copy array/object, and if there is another array/object in the original array or object, then an address of the array/object is copied not values. It means copied array/object which belongs to the original array/object is no more individual array/object. If we wa.. 2023. 6. 13. 2023-05-16 javascript_array let voteCounter = {}; /*let i=0; let j=0;*/ for (let name of votes) { /*if(name==='이재식'){ voteCounter[name]=++i; }else{ voteCounter[name]=++j; }*/ if(name in voteCounter){ voteCounter[name]=voteCounter[name]+1; }else{ voteCounter[name]=1; } } We don't have to define variable i and j, if we use the second codes not the first codes. 2023. 5. 16. 2023-05-08 javascript let before=1, after=1, sum=0; for (let i=1;i 2023. 5. 8. 2023-05-07 javascript When we define funtion, if we do not write 'return statement', then function returns 'undefined' value. We can assign some values to parameters. function introduce(name, age, nationality='South Korea'){ } We call these parameters as optional parameters. Optional parameters should be defined last like the example. We should define constant variable like this const MY_NUM = 1; We can select same c.. 2023. 5. 7. 이전 1 2 다음