I have function getCartItems in cart.js and I want to call that function in another class checkout.js than how can I do this ?
I have function getCartItems in cart.js and I want to call that function in
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to include the script file
cart.jsin your page before you includecheckout.js. Assuming the functiongetCartItemsis declared in the global namespace, that’s all you have to do.However, don’t confuse a Javascipt source file for a class. Javascript does not have classes in that sense.