current position:Home>Are there any specific steps to create a prototype, such as JavaScript?
Are there any specific steps to create a prototype, such as JavaScript?
2022-04-29 06:58:58【CSDN Q & A】
# Prototype object creation method case
javascript
The specific implementation steps are as follows :
a) Create a constructor Clothes().
b) be based on Clothes() newly added 2 Objects clothes1、clothes2.
c) Use prototype Add to constructor type attribute .
d) Use prototype attribute , Give constructors Clothes() add to Clothes_fun Method .
e) Output the results in the page .
yuan Do you have the code ?
Take the answer :
I followed the steps to write down
// a) Create a constructor Clothes() function Clothes() {} // b) be based on Clothes() newly added 2 Objects clothes1、clothes2 let clothes1 = new Clothes() let clothes2 = new Clothes() // c) Use prototype Add to constructor type attribute Clothes.prototype.type = 'type' // d) Use prototype attribute , Give constructors Clothes() add to Clothes_fun Method Clothes.prototype.Clothes_fun = function() { console.log('Clothes_fun') } // e) Output the results in the page document.write(clothes1 + '<br>') document.write(JSON.stringify(clothes2)) console.log('clothes1', clothes1) console.log('clothes2', clothes2)
copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/112/202204221325191464.html
The sidebar is recommended
- Where is the user information obtained by the front end
- [entry DIARY 7 - ref of react]
- React - higher order functions and controlled components
- Differences, advantages and disadvantages between Ajax and Axios
- Choose Java or front-end for training and learning
- Simple sorting of JavaScript deep copy and shallow copy
- Analysis of event loop mechanism in JavaScript
- Epidemic prevention and control system of front and rear end separation based on Vue + nodejs
- Implementation of enterprise personnel management system by separating the front and back ends of springboot + Vue
- Vue difference between two arrays
guess what you like
Vue openlayer add wind farm effect
How to get child nodes of elements in HTML
The file code with HTML suffix of vscode is not highlighted
Use the table in Vue element admin in Vue admin template?
[JavaScript] convert numerical value to numerical value
Differences, advantages and disadvantages between Ajax and Axios
Quietly tell you: the wrong place in react18 document
The new smart spirit 1 starts in Asia! Breaking 100 in 6.7 seconds + frameless door, 190000 pre-sale
Analysis of event loop mechanism in JavaScript
Error occurred when installing vant on webstorm
Random recommended
- With the blessing of tinnove system, Changan uni-v does not have its own table
- Judging the application direction of small flat wire motor from SM 4x4 driverless technology verification vehicle
- Vue3 + nuxt3 build SSR website application, and realize server-side rendering from 0 to 1 without secret Fen sharing
- Vue3 + nuxt3 build SSR website application, and realize server-side rendering from 0 to 1 without secret Fen sharing
- Vue3 + nuxt3 build SSR website application, and realize server-side rendering from 0 to 1 without secret Fen sharing
- React bread crumbs
- HTTP network protocol
- Vue3 + nuxt3 build SSR website application, and realize server-side rendering from 0 to 1 without secret Fen sharing
- Vue3 + nuxt3 build SSR website application, and realize server-side rendering from 0 to 1 without secret Fen sharing
- Use of vuex
- Element UI El table modify input value view not updated
- Getsnapshotbeforeupdate example of react
- Recently, the MySQL server on the cloud was hacked. It took 20 minutes to modify the password after being mercilessly encrypted. This time I'll be hacked with your last name
- Java project: sporting goods Mall (java + springboot + jsp + HTML + Maven + MySQL)
- Java project: shared study room reservation management system (java + springboot + thymeleaf + HTML + Maven + MySQL)
- Java project: sporting goods Mall (java + springboot + jsp + HTML + Maven + MySQL)
- Java project: shared study room reservation management system (java + springboot + thymeleaf + HTML + Maven + MySQL)
- Sennheiser momentum true wireless 3 true wireless headphones will be available on May 10
- How to realize Ethernet wireless communication between 200smartplc?
- Coffeescript 2.7.0 release, JavaScript translation language
- Still working on nginx configuration? Try this visual configuration tool. It's really powerful!
- Im instant messaging development: load balancing of high-performance HTTP server
- Simple sorting of JavaScript deep copy and shallow copy
- React realizes the communication of brother components by means of message subscription and publication
- React limits props
- Java lesson 30
- Java lesson 29 136 The number 1189 appears only once Maximum number of balloons
- Simple sorting of JavaScript deep copy and shallow copy
- "Geely" new SUV is equipped with frameless doors, and the interior is more beautiful than Mercedes Benz. Can 19 universal accept it?
- Configuration of using less in react project
- Expression used in react render
- React configuration agent
- JQuery sends a post request (a method of connecting PHP variables to strings)
- Solve the problem that Django cannot access the local server( http://127.0.0.1:8000/ )Or the problem that the command line execution (Python 3 manage.py runserver 0.0.0.0:8000) does not respond
- Summary of the writing method of react router V6
- Bipeng ditch, punch in and net red, open-air boundless swimming pool, Ramada hot spring, encounter the beauty of the four seasons
- JavaScript gets and modifies elements. What's wrong with not extracting the classlist attribute
- Mixed mixin of Vue
- Vue + element implements table filtering
- Vue router2. 0