Объектно-ориентированный JavaScript

Попробуйте этот код VBA

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim MyRNG As Range: Set MyRNG = Range("B2:B20") 'change your required range here
If Not Application.Intersect(MyRNG, Target) Is Nothing Then
ActiveCell.NumberFormat = "0.00 ""of EBITDA margin"""
End If
End Sub
5
задан rahul 29 April 2009 в 04:22
поделиться

5 ответов

First of all I think that you have to understand how JavaScript object orientation works, JavaScript OO is Prototype-based, in which classes are not present, and behavior reuse is implemented by prototyping.

I've seen that this can be hard to catch at the beginning for programmers that have been working on conventional class-based object-oriented languages (like C++, C#, Java, etc).

Recommended articles:

12
ответ дан 18 December 2019 в 10:48
поделиться

There are two things I would do:

  1. Read. If there's documentation files, read those. If there's comments, read those. If neither of those help you, then go to the source and read that.

  2. When you talk about open source Javascript, I assume you mean this JS is collected into some kind of project; all client-side JS is open source :P. In that case, the authors may be willing to tell you about their code. Locate their email on the project page, and ask them to give you a high-level overview of the code so you can start reading it and understanding it yourself. They probably won't be willing to hold your hand through the entire thing, but having that as a starting point would probably help.

3
ответ дан 18 December 2019 в 10:48
поделиться

I agree with allyourcode there's no magic trick. You have to read the code and read the docs. And if the docs are no good, maybe you should think about using a different framework.

0
ответ дан 18 December 2019 в 10:48
поделиться

A good start is in understanding the difference between traditional OO and Javascript's Prototype model. (Crockford has some articless that implement traditional OO for Javascript in order to contrast the behaviors.)

0
ответ дан 18 December 2019 в 10:48
поделиться

У меня есть копия

и

, которая сейчас стоит у меня на столе. Кстати, это единственные две книги по Javascript, которые Дуглас Крокфорд считает хорошими;)

Они научат вас, как работает Javascript, в частности, как его объектная модель отличается от большинства (но не всех) других объектно-ориентированных языков.

Кроме этого, ознакомьтесь со всеми статьями на веб-сайте Крокфорда , как уже упоминалось в других ответах.

1
ответ дан 18 December 2019 в 10:48
поделиться
Другие вопросы по тегам:

Похожие вопросы: