Javascript

@LearningJavascript

learning

Public team

Community (0)
No community contribution yet

Joined on Feb 28, 2021

  • 1-There are a couple of different ways you can copy an object. The easiest way to copy something is via something called a spread. A spread is a three dot operator and it's used for taking every single item in a object and spreading it into a new object. const person3 = { ...person1 }; 2-There is another way to do this
     Like  Bookmark
  •  Like  Bookmark
  • name of 6th data type? 1- string 2- number 3- boolean 4- object 4- null 5- undefined 6- symbol What are JavaScript Data Types?
     Like  Bookmark
  • variable are container for storing data. Ex--Rice container. rice is value var y = "rice"; Q. if we have var x; then what is x value of x? var x; value of x is undefine.
     Like  Bookmark
  • Q: const list = [1,2,3,4] const guestList = ([x, ...y]) =>{ return (x,y); }; console.log(guestList(list)); Ans: [2,3,4] because javascript return only one element. Q: user ={name:"test", age:21} const guest =(user.name, user.age);
     Like  Bookmark
  • result come [1,2,3,4,5] arr = [2,3,4]; function add(){ arr.push(5); arr.unshift(1); return arr; } add(arr);
     Like  Bookmark
  • If the array is sparse, the value of the length property is greater than the number of elements. Ex-- var arr = [undefined × 5, 1, 2, 3]; arr.length; Ans-- 4 Q: In javascript, arrays are sparse. Ans:yes Q:In javascript, the length property always tells us how many elements are there in an array.
     Like  Bookmark
  • function userName() { // user name this var _this = this; ​​​​function show() { ​​​​ var show_this = this; ​​​​ console.log(_this); ​​​​} }
     Like  Bookmark
  • https://www.youtube.com/watch?v=eQOLcKZIPzA const parentdiv = document.getElementById('parentdiv'); const childdiv = document.getElementById('childdiv'); ​​​​const parentCall=()=>{ ​​​​ alert("parent box call");
     Like  Bookmark
  • 1-NaN is the property of global object. 2-it is a variable in global scope. 3- the initial value of the NaN is not a number.
     Like  Bookmark
  • undefine => absence of value var x; undefine var y = null null typeof x; undefine
     Like  Bookmark
  • https://www.youtube.com/watch?v=m0-0kBMmsPk
     Like  Bookmark
  • function runDoc(callback) { // may be task top callback() // may be callback function call at top // task middle callback() // may be in call middle // task done/end callback() // may be call in end (final run with final value)
     Like  Bookmark
  • var arr = ['a', 'b', 'c', 'd', 'e', 'f']; for (var i = 0; i < arr.length; i++) { console.log(arr[i]); arr.splice(i + 1, 1); } Be careful! Answer a c e
     Like  Bookmark
  • Q: Write a javascript function named reverse which takes a string argument and returns the reversed string. Ans function rev(str){ var arr = str.split(""); var result = arr.reverse().join(""); console.log(result); } rev("push");
     Like  Bookmark
  • When the page loads, it is called an event. When the user clicks a button, that click too is an event. Other examples include events like pressing any key, closing a window, resizing a window, etc. function A function is a group of reusable code which can be called anywhere in your program.
     Like  Bookmark
  • https://www.frontendcheatsheets.com/javascript
     Like  Bookmark
  • the difference between a method and a function is that a method is just a function that lives inside of an object. //function function show(value) { // task perform } // method const user = { show: function() {
     Like  Bookmark
  • Template strings support interpolation! This means you could write a variable in your string, and get its value. The syntax is straightforward, you simply wrap your variable name with a dollar sign and curly braces. Let's take an example where we have a variable language with a value of JavaScript. const language = 'javascript'; I am learning ${language}; //"I am learning JavaScript"; (get the output) 1-A template string is a string created with the backtick character: ` 2-Template strings can span multiple lines 3-Template strings support interpolation with the ${variableName} syntax
     Like  Bookmark
  • https://www.freecodecamp.org/news/arrow-function-javascript-tutorial-how-to-declare-a-js-function-with-the-new-es6-syntax/
     Like  Bookmark